| java.lang.Object org.apache.commons.discovery.tools.EnvironmentCache
EnvironmentCache | public class EnvironmentCache (Code) | | Cache by a 'key' unique to the environment:
- ClassLoader::groupContext::Object Cache
Cache : HashMap
Key : Thread Context Class Loader (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.
author: Richard A. Sitze |
Field Summary | |
final public static int | smallHashSize Initial hash size for SPI's, default just seem TO big today.. |
Method Summary | |
public static synchronized Object | get(ClassLoader classLoader) Get object keyed by classLoader. | public static synchronized void | put(ClassLoader classLoader, Object object) Put service keyed by spi & classLoader. | public static synchronized void | release() Release all internal references to previously created service
instances associated with the current thread context class loader. | public static synchronized void | release(ClassLoader classLoader) Release any internal references to a previously created service
instance associated with the current thread context class loader. |
smallHashSize | final public static int smallHashSize(Code) | | Initial hash size for SPI's, default just seem TO big today..
|
put | public static synchronized void put(ClassLoader classLoader, Object object)(Code) | | Put service keyed by spi & classLoader.
|
release | public static synchronized void release()(Code) | | Release all internal references to previously created service
instances associated with the current thread context class loader.
The 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.
|
release | public static synchronized void release(ClassLoader classLoader)(Code) | | Release any internal references to a previously created service
instance associated with the current thread context class loader.
If the SPI instance implements Service , then call
release() .
|
|
|