Class ClassLoaderCache
java.lang.Object
com.gigaspaces.internal.classloader.ClassLoaderCache
- All Implemented Interfaces:
SelfCleaningTable.ICleanerListener<Long>
A class loaders cache, each class loader is associated with a long key value All the class loader
are kept as weak references and can be explicitly removed
- Since:
- 7.0.1
- Author:
- eitany
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ClassLoaderCachegetCache()Gets the singleton cache instancegetClassLoader(Long key) Gets class loader by keygetClassLoaderKey(ClassLoader classLoader) Gets the key for the specified class loaderputClassLoader(ClassLoader classLoader) Add new class loader to the cache, if the class loader is already present, the existing key will be returnedvoidRegister for cache state changed events, the listener is kept as weak reference, all subscribers must keep a strong reference to the listener to keep this notification active, this will trigger history events of at most last 100 removed class loaderbooleanregisterClassLoaderStateListener(Long classLoaderKey, IClassLoaderCacheStateListener listener) Register for a specified class loader key state events, the listener is kept as weak reference, all subscribers must keep a strong reference to the listener to keep this notification activevoidremoveClassLoader(ClassLoader classLoader) Remove the specified class loader TODO : not properly removed classloader!voidremoveClassLoaderStateListener(Long classLoaderKey, IClassLoaderCacheStateListener listener) Remove a specific listener from a specific class listenervoidshutdown()voidweakEntryRemoved(Long value)
-
Constructor Details
-
ClassLoaderCache
protected ClassLoaderCache(long removedRelevantWindow)
-
-
Method Details
-
getCache
Gets the singleton cache instance -
shutdown
public void shutdown() -
putClassLoader
Add new class loader to the cache, if the class loader is already present, the existing key will be returned- Returns:
- identifier key for the specified class loader
-
getClassLoader
Gets class loader by key- Returns:
- null if none associated to the given key
-
removeClassLoader
Remove the specified class loader TODO : not properly removed classloader! -
weakEntryRemoved
- Specified by:
weakEntryRemovedin interfaceSelfCleaningTable.ICleanerListener<Long>
-
getClassLoaderKey
Gets the key for the specified class loader -
registerCacheStateListener
Register for cache state changed events, the listener is kept as weak reference, all subscribers must keep a strong reference to the listener to keep this notification active, this will trigger history events of at most last 100 removed class loader -
registerClassLoaderStateListener
public boolean registerClassLoaderStateListener(Long classLoaderKey, IClassLoaderCacheStateListener listener) Register for a specified class loader key state events, the listener is kept as weak reference, all subscribers must keep a strong reference to the listener to keep this notification active- Returns:
- true if registration successful, which means the specified class loader key exists in the cache
-
removeClassLoaderStateListener
public void removeClassLoaderStateListener(Long classLoaderKey, IClassLoaderCacheStateListener listener) Remove a specific listener from a specific class listener
-