Class ClassLoaderCache

java.lang.Object
com.gigaspaces.internal.classloader.ClassLoaderCache
All Implemented Interfaces:
SelfCleaningTable.ICleanerListener<Long>

public class ClassLoaderCache extends Object implements 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 Details

    • ClassLoaderCache

      protected ClassLoaderCache(long removedRelevantWindow)
  • Method Details

    • getCache

      public static ClassLoaderCache getCache()
      Gets the singleton cache instance
    • shutdown

      public void shutdown()
    • putClassLoader

      public Long putClassLoader(ClassLoader classLoader)
      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

      public ClassLoader getClassLoader(Long key)
      Gets class loader by key
      Returns:
      null if none associated to the given key
    • removeClassLoader

      public void removeClassLoader(ClassLoader classLoader)
      Remove the specified class loader TODO : not properly removed classloader!
    • weakEntryRemoved

      public void weakEntryRemoved(Long value)
      Specified by:
      weakEntryRemoved in interface SelfCleaningTable.ICleanerListener<Long>
    • getClassLoaderKey

      public Long getClassLoaderKey(ClassLoader classLoader)
      Gets the key for the specified class loader
    • registerCacheStateListener

      public void registerCacheStateListener(IClassLoaderCacheStateListener listener)
      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