public class EnvironmentCache extends Object
ClassLoader
)
Value : groupContext::SPI Cache (HashMap
)
//- groupContext::Object Cache
// Cache : HashMap
// Key : groupContext (String
)
// Value : Object
When we 'release', it is expected that the caller of the 'release'
have the same thread context class loader... as that will be used
to identify cached entries to be released.Modifier and Type | Field and Description |
---|---|
static int |
smallHashSize
Initial hash size for SPI's, default just seem TO big today..
|
Constructor and Description |
---|
EnvironmentCache() |
Modifier and Type | Method and Description |
---|---|
static Map<String,Object> |
get(ClassLoader classLoader)
Get object keyed by classLoader.
|
static void |
put(ClassLoader classLoader,
Map<String,Object> spis)
Put service keyed by spi & classLoader.
|
static void |
release()
Release all internal references to previously created service
instances associated with the current thread context class loader.
|
static void |
release(ClassLoader classLoader)
Release any internal references to a previously created service
instance associated with the current thread context class loader.
|
public static final int smallHashSize
public static Map<String,Object> get(ClassLoader classLoader)
classLoader
- The class loader keypublic static void put(ClassLoader classLoader, Map<String,Object> spis)
classLoader
- The class loader keyspis
- The SPI name/instance cachepublic static void release()
release()
method is called for service instances that
implement the Service
interface.
This is useful in environments like servlet containers,
which implement application reloading by throwing away a ClassLoader.
Dangling references to objects in that class loader would prevent
garbage collection.public static void release(ClassLoader classLoader)
Service
, then call
release()
.classLoader
- The class loader keyCopyright © 2002–2016 The Apache Software Foundation. All rights reserved.