Class CacheManager


  • public class CacheManager
    extends java.lang.Object
    A container for Ehcaches that maintain all aspects of their lifecycle.

    CacheManager may be either be a singleton if created with factory methods, or multiple instances may exist, in which case resources required by each must be unique.

    A CacheManager holds references to Caches and Ehcaches and manages their creation and lifecycle.

    Version:
    $Id$
    Author:
    Greg Luck
    • Field Detail

      • DEFAULT_NAME

        public static final java.lang.String DEFAULT_NAME
        Default name if not specified in the configuration/
        See Also:
        Constant Field Values
      • ON_HEAP_THRESHOLD

        public static final double ON_HEAP_THRESHOLD
        Threshold, in percent of the available heap, above which the CacheManager will warn if the configured memory
        See Also:
        Constant Field Values
      • ALL_CACHE_MANAGERS

        public static final java.util.List<CacheManager> ALL_CACHE_MANAGERS
        Keeps track of all known CacheManagers. Used to check on conflicts. CacheManagers should remove themselves from this list during shut down.
      • ENABLE_SHUTDOWN_HOOK_PROPERTY

        public static final java.lang.String ENABLE_SHUTDOWN_HOOK_PROPERTY
        System property to enable creation of a shutdown hook for CacheManager.
        See Also:
        Constant Field Values
      • status

        protected volatile Status status
        Status of the Cache Manager
      • cacheManagerPeerProviders

        protected final java.util.Map<java.lang.String,​CacheManagerPeerProvider> cacheManagerPeerProviders
        The map of providers
      • cacheManagerPeerListeners

        protected final java.util.Map<java.lang.String,​CacheManagerPeerListener> cacheManagerPeerListeners
        The map of listeners
      • shutdownHook

        protected java.lang.Thread shutdownHook
        The shutdown hook thread for CacheManager. This ensures that the CacheManager and Caches are left in a consistent state on a CTRL-C or kill.

        This thread must be unregistered as a shutdown hook, when the CacheManager is disposed. Otherwise the CacheManager is not GC-able.

        Of course kill -9 or abrupt termination will not run the shutdown hook. In this case, various sanity checks are made at start up.

    • Constructor Detail

      • CacheManager

        public CacheManager​(Configuration configuration)
                     throws CacheException
        An constructor for CacheManager, which takes a configuration object, rather than one created by parsing an ehcache.xml file. This constructor gives complete control over the creation of the CacheManager.

        Care should be taken to ensure that, if multiple CacheManages are created, they do now overwrite each others disk store files, as would happend if two were created which used the same diskStore path.

        This method does not act as a singleton. Callers must maintain their own reference to it.

        Note that if one of the create() methods are called, a new singleton instance will be created, separate from any instances created in this method. Since 2.5, every newly created CacheManager is registered with its name (uses a default name if unnamed), and trying to create multiple CacheManager with same names (or multiple unnamed CacheManagers) is not allowed and throws an exception. It is recommended to use one of the newInstance() methods to instantiate new CacheManagers as those methods return the same instance of CacheManager for same names (or unnamed). Shutting down the CacheManager will deregister it and new ones can be created again.

        Parameters:
        configuration -
        Throws:
        CacheException
      • CacheManager

        public CacheManager​(java.lang.String configurationFileName)
                     throws CacheException
        An ordinary constructor for CacheManager. This method does not act as a singleton. Callers must maintain a reference to it. Note that if one of the create() methods are called, a new singleton will be created, separate from any instances created in this method. Since 2.5, every newly created CacheManager is registered with its name (uses a default name if unnamed), and trying to create multiple CacheManager with same names (or multiple unnamed CacheManagers) is not allowed and throws an exception. Using any of the newInstance() methods also registers the CacheManager with its name. It is recommended to use one of the newInstance() methods to instantiate new CacheManagers as those methods return the same instance of CacheManager for same names (or unnamed). Shutting down the CacheManager will deregister it and new ones can be created again.
        Parameters:
        configurationFileName - an xml configuration file available through a file name. The configuration File is created using new File(configurationFileName)
        Throws:
        CacheException
        See Also:
        newInstance(String)
      • CacheManager

        public CacheManager​(java.net.URL configurationURL)
                     throws CacheException
        An ordinary constructor for CacheManager. This method does not act as a singleton. Callers must maintain a reference to it. Note that if one of the create() methods are called, a new singleton will be created, separate from any instances created in this method. Since 2.5, every newly created CacheManager is registered with its name (uses a default name if unnamed), and trying to create multiple CacheManager with same names (or multiple unnamed CacheManagers) is not allowed and throws an exception. Using any of the newInstance() methods also registers the CacheManager with its name. It is recommended to use one of the newInstance() methods to instantiate new CacheManagers as those methods return the same instance of CacheManager for same names (or unnamed). Shutting down the CacheManager will deregister it and new ones can be created again.

        This method can be used to specify a configuration resource in the classpath other than the default of \"/ehcache.xml\":

         URL url = this.getClass().getResource("/ehcache-2.xml");
         
        Note that Class.getResource(String) will look for resources in the same package unless a leading "/" is used, in which case it will look in the root of the classpath.

        You can also load a resource using other class loaders. e.g. Thread.getContextClassLoader()

        Parameters:
        configurationURL - an xml configuration available through a URL.
        Throws:
        CacheException
        Since:
        1.2
        See Also:
        newInstance(java.net.URL)
      • CacheManager

        public CacheManager​(java.io.InputStream configurationInputStream)
                     throws CacheException
        An ordinary constructor for CacheManager. This method does not act as a singleton. Callers must maintain a reference to it. Note that if one of the create() methods are called, a new singleton will be created, separate from any instances created in this method. Since 2.5, every newly created CacheManager is registered with its name (uses a default name if unnamed), and trying to create multiple CacheManager with same names (or multiple unnamed CacheManagers) is not allowed and throws an exception. Using any of the newInstance() methods also registers the CacheManager with its name. It is recommended to use one of the newInstance() methods to instantiate new CacheManagers as those methods return the same instance of CacheManager for same names (or unnamed). Shutting down the CacheManager will deregister it and new ones can be created again.
        Parameters:
        configurationInputStream - an xml configuration file available through an inputstream
        Throws:
        CacheException
        See Also:
        newInstance(java.io.InputStream)
      • CacheManager

        public CacheManager()
                     throws CacheException
        Constructor. Since 2.5, every newly created CacheManager is registered with its name (uses a default name if unnamed), and trying to create multiple CacheManager with same names (or multiple unnamed CacheManagers) is not allowed and throws an exception. Using any of the newInstance() methods also registers the CacheManager with its name. It is recommended to use one of the newInstance() methods to instantiate new CacheManagers as those methods return the same instance of CacheManager for same names (or unnamed). Shutting down the CacheManager will deregister it and new ones can be created again.
        Throws:
        CacheException
    • Method Detail

      • init

        protected void init​(Configuration initialConfiguration,
                            java.lang.String configurationFileName,
                            java.net.URL configurationURL,
                            java.io.InputStream configurationInputStream)
        initialises the CacheManager
        Parameters:
        initialConfiguration - the initial configuration
        configurationFileName - the name of the configuration file
        configurationInputStream - the configuration input stream
        configurationURL - the configuration URL
      • getOnHeapPool

        public Pool getOnHeapPool()
        Return this cache manager's shared on-heap pool
        Returns:
        this cache manager's shared on-heap pool
      • getOnDiskPool

        public Pool getOnDiskPool()
        Return this cache manager's shared on-disk pool
        Returns:
        this cache manager's shared on-disk pool
      • getClusterUUID

        public java.lang.String getClusterUUID()
        Returns unique cluster-wide id for this cache-manager. Only applicable when running in "cluster" mode, e.g. when this cache-manager contains caches clustered with Terracotta. Otherwise returns blank string.
        Returns:
        Returns unique cluster-wide id for this cache-manager when it contains clustered caches (e.g. Terracotta clustered caches). Otherwise returns blank string.
      • createTerracottaStore

        public Store createTerracottaStore​(Ehcache cache)
        Create/access the appropriate terracotta clustered store for the given cache
        Parameters:
        cache - The cache for which the Store should be created
        Returns:
        a new (or existing) clustered store
      • createTerracottaWriteBehind

        public WriteBehind createTerracottaWriteBehind​(Ehcache cache)
        Create/access the appropriate clustered write behind queue for the given cache
        Parameters:
        cache - The cache for which the write behind queue should be created
        Returns:
        a new (or existing) write behind queue
      • createTerracottaEventReplicator

        public CacheEventListener createTerracottaEventReplicator​(Ehcache cache)
        Create/access the appropriate clustered cache event replicator for the given cache
        Parameters:
        cache - The cache for which the clustered event replicator should be created
        Returns:
        a new cache event replicator
      • getClusteredInstanceFactory

        protected ClusteredInstanceFactory getClusteredInstanceFactory()
        Return the clustered instance factory for a cache of this cache manager.
        Returns:
        the clustered instance factory
      • create

        public static CacheManager create()
                                   throws CacheException
        A factory method to create a singleton CacheManager with default config, or return it if it exists.

        The configuration will be read, Ehcaches created and required stores initialized. When the CacheManager is no longer required, call shutdown to free resources.

        Returns:
        the singleton CacheManager
        Throws:
        CacheException - if the CacheManager cannot be created
      • newInstance

        public static CacheManager newInstance()
                                        throws CacheException
        A factory method to create a CacheManager with default config, or return it if it exists.

        The configuration will be read, Ehcaches created and required stores initialized. When the CacheManager is no longer required, call shutdown to free resources.

        Returns:
        the singleton CacheManager
        Throws:
        CacheException - if the CacheManager cannot be created
      • getInstance

        public static CacheManager getInstance()
                                        throws CacheException
        A factory method to create a singleton CacheManager with default config, or return it if it exists.

        This has the same effect as create()

        Same as create()

        Returns:
        the singleton CacheManager
        Throws:
        CacheException - if the CacheManager cannot be created
      • create

        public static CacheManager create​(java.lang.String configurationFileName)
                                   throws CacheException
        A factory method to create a singleton CacheManager with a specified configuration.
        Parameters:
        configurationFileName - an xml file compliant with the ehcache.xsd schema

        The configuration will be read, Ehcaches created and required stores initialized. When the CacheManager is no longer required, call shutdown to free resources.

        Throws:
        CacheException
      • newInstance

        public static CacheManager newInstance​(java.lang.String configurationFileName)
                                        throws CacheException
        A factory method to create a CacheManager with a specified configuration.

        If the specified configuration has different names for the CacheManager, it will return a new one for each unique name or return already created one.

        Parameters:
        configurationFileName - an xml file compliant with the ehcache.xsd schema

        The configuration will be read, Ehcaches created and required stores initialized. When the CacheManager is no longer required, call shutdown to free resources.

        Throws:
        CacheException
      • create

        public static CacheManager create​(java.net.URL configurationFileURL)
                                   throws CacheException
        A factory method to create a singleton CacheManager from an URL.

        This method can be used to specify a configuration resource in the classpath other than the default of \"/ehcache.xml\": This method can be used to specify a configuration resource in the classpath other than the default of \"/ehcache.xml\":

         URL url = this.getClass().getResource("/ehcache-2.xml");
         
        Note that Class.getResource(String) will look for resources in the same package unless a leading "/" is used, in which case it will look in the root of the classpath.

        You can also load a resource using other class loaders. e.g. Thread.getContextClassLoader()

        Parameters:
        configurationFileURL - an URL to an xml file compliant with the ehcache.xsd schema

        The configuration will be read, Ehcaches created and required stores initialized. When the CacheManager is no longer required, call shutdown to free resources.

        Throws:
        CacheException
      • newInstance

        public static CacheManager newInstance​(java.net.URL configurationFileURL)
                                        throws CacheException
        A factory method to create a CacheManager from an URL.

        This method can be used to specify a configuration resource in the classpath other than the default of \"/ehcache.xml\": This method can be used to specify a configuration resource in the classpath other than the default of \"/ehcache.xml\":

         URL url = this.getClass().getResource("/ehcache-2.xml");
         
        Note that Class.getResource(String) will look for resources in the same package unless a leading "/" is used, in which case it will look in the root of the classpath.

        You can also load a resource using other class loaders. e.g. Thread.getContextClassLoader() If the specified configuration has different names for the CacheManager, it will return a new one for each unique name or return already created one.

        Parameters:
        configurationFileURL - an URL to an xml file compliant with the ehcache.xsd schema

        The configuration will be read, Ehcaches created and required stores initialized. When the CacheManager is no longer required, call shutdown to free resources.

        Throws:
        CacheException
      • create

        public static CacheManager create​(java.io.InputStream inputStream)
                                   throws CacheException
        A factory method to create a singleton CacheManager from a java.io.InputStream.

        This method makes it possible to use an inputstream for configuration. Note: it is the clients responsibility to close the inputstream.

        Parameters:
        inputStream - InputStream of xml compliant with the ehcache.xsd schema

        The configuration will be read, Ehcaches created and required stores initialized. When the CacheManager is no longer required, call shutdown to free resources.

        Throws:
        CacheException
      • newInstance

        public static CacheManager newInstance​(java.io.InputStream inputStream)
                                        throws CacheException
        A factory method to create a CacheManager from a java.io.InputStream.

        This method makes it possible to use an inputstream for configuration. Note: it is the clients responsibility to close the inputstream.

        If the specified configuration has different names for the CacheManager, it will return a new one for each unique name or return already created one.

        Parameters:
        inputStream - InputStream of xml compliant with the ehcache.xsd schema

        The configuration will be read, Ehcaches created and required stores initialized. When the CacheManager is no longer required, call shutdown to free resources.

        Throws:
        CacheException
      • newInstance

        public static CacheManager newInstance​(Configuration config)
        A factory method to create a CacheManager from a net.sf.ehcache.config.Configuration.

        If the specified configuration has different names for the CacheManager, it will return a new one for each unique name or return already created one.

        Parameters:
        config -
      • getCacheManager

        public static CacheManager getCacheManager​(java.lang.String name)
        Checks if a cacheManager already exists for a given name and gets it.
        Parameters:
        name - the cacheManager name.
        Returns:
        if a cacheManager exists with given name returns the CacheManager, otherwise returns null. If name is null, returns the default unnamed cacheManager if it has been created already otherwise returns null
      • getCache

        public Cache getCache​(java.lang.String name)
                       throws java.lang.IllegalStateException,
                              java.lang.ClassCastException
        Returns a concrete implementation of Cache, it it is available in the CacheManager. Consider using getEhcache(String name) instead, which will return decorated caches that are registered.

        If a decorated ehcache is registered in CacheManager, an undecorated Cache with the same name may also exist. Since version ehcache-core-2.1.0, when an Ehcache decorator is present in the CacheManager, its not necessary that a Cache instance is also present for the same name. Decorators can have different names other than the name of the cache its decorating.

        Returns:
        a Cache, if an object of that type exists by that name, else null
        Throws:
        java.lang.IllegalStateException - if the cache is not Status.STATUS_ALIVE
        java.lang.ClassCastException
        See Also:
        getEhcache(String)
      • getEhcache

        public Ehcache getEhcache​(java.lang.String name)
                           throws java.lang.IllegalStateException
        Gets an Ehcache

        Returns:
        a Cache, if an object of type Cache exists by that name, else null
        Throws:
        java.lang.IllegalStateException - if the cache is not Status.STATUS_ALIVE
      • addCache

        public void addCache​(java.lang.String cacheName)
                      throws java.lang.IllegalStateException,
                             ObjectExistsException,
                             CacheException
        Adds a Ehcache based on the defaultCache with the given name.

        Memory and Disk stores will be configured for it and it will be added to the map of caches.

        Also notifies the CacheManagerEventListener after the cache was initialised and added.

        It will be created with the defaultCache attributes specified in ehcache.xml

        Parameters:
        cacheName - the name for the cache
        Throws:
        ObjectExistsException - if the cache already exists
        CacheException - if there was an error creating the cache.
        java.lang.IllegalStateException
      • addCache

        public void addCache​(Cache cache)
                      throws java.lang.IllegalStateException,
                             ObjectExistsException,
                             CacheException
        Adds a Cache to the CacheManager.

        Memory and Disk stores will be configured for it and it will be added to the map of caches. Also notifies the CacheManagerEventListener after the cache was initialised and added.

        Parameters:
        cache -
        Throws:
        java.lang.IllegalStateException - if the cache is not Status.STATUS_UNINITIALISED before this method is called.
        ObjectExistsException - if the cache already exists in the CacheManager
        CacheException - if there was an error adding the cache to the CacheManager
      • addCache

        public void addCache​(Ehcache cache)
                      throws java.lang.IllegalStateException,
                             ObjectExistsException,
                             CacheException
        Adds an Ehcache to the CacheManager.

        Memory and Disk stores will be configured for it and it will be added to the map of caches. Also notifies the CacheManagerEventListener after the cache was initialised and added.

        Parameters:
        cache -
        Throws:
        java.lang.IllegalStateException - if the cache is not Status.STATUS_UNINITIALISED before this method is called.
        ObjectExistsException - if the cache already exists in the CacheManager
        CacheException - if there was an error adding the cache to the CacheManager
      • addDecoratedCache

        public void addDecoratedCache​(Ehcache decoratedCache)
                               throws ObjectExistsException
        Adds a decorated Ehcache to the CacheManager. This method neither creates the memory/disk store nor initializes the cache. It only adds the cache reference to the map of caches held by this cacheManager.

        It is generally required that a decorated cache, once constructed, is made available to other execution threads. The simplest way of doing this is to either add it to the cacheManager with a different name or substitute the original cache with the decorated one.

        This method adds the decorated cache assuming it has a different name. If another cache (decorated or not) with the same name already exists, it will throw ObjectExistsException. For replacing existing cache with another decorated cache having same name, please use replaceCacheWithDecoratedCache(Ehcache, Ehcache)

        Note that any overridden Ehcache methods by the decorator will take on new behaviours without casting. Casting is only required for new methods that the decorator introduces. For more information see the well known Gang of Four Decorator pattern.

        Parameters:
        decoratedCache -
        Throws:
        ObjectExistsException - if another cache with the same name already exists.
      • cacheExists

        public boolean cacheExists​(java.lang.String cacheName)
                            throws java.lang.IllegalStateException
        Checks whether a cache of type ehcache exists.
        Parameters:
        cacheName - the cache name to check for
        Returns:
        true if it exists
        Throws:
        java.lang.IllegalStateException - if the cache is not Status.STATUS_ALIVE
      • removeAllCaches

        public void removeAllCaches()
        Removes all caches using removeCache(String) for each cache.
      • removeCache

        public void removeCache​(java.lang.String cacheName)
                         throws java.lang.IllegalStateException
        Remove a cache from the CacheManager. The cache is disposed of.
        Parameters:
        cacheName - the cache name
        Throws:
        java.lang.IllegalStateException - if the cache is not Status.STATUS_ALIVE
      • shutdown

        public void shutdown()
        Shuts down the CacheManager.

        If the shutdown occurs on the singleton, then the singleton is removed, so that if a singleton access method is called, a new singleton will be created.

        By default there is no shutdown hook (ehcache-1.3-beta2 and higher).

        Set the system property net.sf.ehcache.enableShutdownHook=true to turn it on.

      • getCacheNames

        public java.lang.String[] getCacheNames()
                                         throws java.lang.IllegalStateException
        Returns a list of the current cache names.
        Returns:
        an array of Strings
        Throws:
        java.lang.IllegalStateException - if the cache is not Status.STATUS_ALIVE
      • checkStatus

        protected void checkStatus()
        Checks the state of the CacheManager for legal operation
      • getStatus

        public Status getStatus()
        Gets the status attribute of the Ehcache
        Returns:
        The status value from the Status enum class
      • clearAll

        public void clearAll()
                      throws CacheException
        Clears the contents of all caches in the CacheManager, but without removing any caches.

        This method is not synchronized. It only guarantees to clear those elements in a cache at the time that the Ehcache.removeAll() mehod on each cache is called.

        Throws:
        CacheException
      • clearAllStartingWith

        public void clearAllStartingWith​(java.lang.String prefix)
                                  throws CacheException
        Clears the contents of all caches in the CacheManager with a name starting with the prefix, but without removing them.

        This method is not synchronized. It only guarantees to clear those elements in a cache at the time that the Ehcache.removeAll() method on each cache is called.

        Parameters:
        prefix - The prefix the cache name should start with
        Throws:
        CacheException
        Since:
        1.7.2
      • getCacheManagerPeerProvider

        public CacheManagerPeerProvider getCacheManagerPeerProvider​(java.lang.String scheme)
        Gets the CacheManagerPeerProvider, matching the given scheme For distributed caches, the peer provider finds other cache managers and their caches in the same cluster
        Parameters:
        scheme - the replication scheme to use. Schemes shipped with ehcache are RMI, JGROUPS, JMS
        Returns:
        the provider, or null if one does not exist
      • getCachePeerListener

        public CacheManagerPeerListener getCachePeerListener​(java.lang.String scheme)
        When CacheManage is configured as part of a cluster, a CacheManagerPeerListener will be registered in it. Use this to access the individual cache listeners
        Parameters:
        scheme - the replication scheme to use. Schemes shipped with ehcache are RMI, JGROUPS, JMS
        Returns:
        the listener, or null if one does not exist
      • getCacheManagerEventListener

        public CacheManagerEventListener getCacheManagerEventListener()
        Returns the composite listener. A notification sent to this listener will notify all registered listeners.
        Returns:
        null if none
        See Also:
        "getCacheManagerEventListenerRegistry"
      • setCacheManagerEventListener

        public void setCacheManagerEventListener​(CacheManagerEventListener cacheManagerEventListener)
        Same as getCacheManagerEventListenerRegistry().registerListener(cacheManagerEventListener); Left for backward compatiblity
        Parameters:
        cacheManagerEventListener - the listener to set.
        See Also:
        "getCacheManagerEventListenerRegistry"
      • getCacheManagerEventListenerRegistry

        public CacheManagerEventListenerRegistry getCacheManagerEventListenerRegistry()
        Gets the CacheManagerEventListenerRegistry. Add and remove listeners here.
      • replaceCacheWithDecoratedCache

        public void replaceCacheWithDecoratedCache​(Ehcache ehcache,
                                                   Ehcache decoratedCache)
                                            throws CacheException
        Replaces in the map of Caches managed by this CacheManager an Ehcache with a decorated version of the same Ehcache. CacheManager can operate fully with a decorated Ehcache.

        Ehcache Decorators can be used to obtain different behaviour from an Ehcache in a very flexible way. Some examples in ehcache are:

        1. BlockingCache - A cache that blocks other threads from getting a null element until the first thread has placed a value in it.
        2. SelfPopulatingCache - A BlockingCache that has the additional property of knowing how to load its own entries.
        Many other kinds are possible.

        It is generally required that a decorated cache, once constructed, is made available to other execution threads. The simplest way of doing this is to substitute the original cache for the decorated one here.

        Note that any overwritten Ehcache methods will take on new behaviours without casting. Casting is only required for new methods that the decorator introduces. For more information see the well known Gang of Four Decorator pattern.

        Parameters:
        ehcache -
        decoratedCache - An implementation of Ehcache that wraps the original cache.
        Throws:
        CacheException - if the two caches do not equal each other.
      • getName

        public java.lang.String getName()
        Gets the name of the CacheManager. This is useful for distinguishing multiple CacheManagers
        Returns:
        the name, or the output of toString() if it is not set.
        See Also:
        which uses either the name or Object.toString()
      • isNamed

        public boolean isNamed()
        Indicate whether the CacheManager is named or not.
        Returns:
        True if named
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
        Returns:
        either the name of this CacheManager, or if unset, Object.toString()
      • getDiskStorePathManager

        public DiskStorePathManager getDiskStorePathManager()
        Returns the disk store path manager. This may be null if no caches need a DiskStore and none was configured. The path cannot be changed after creation of the CacheManager. All caches take the disk store path from this manager.
        Returns:
        the disk store path manager.
      • getOriginalConfigurationText

        public java.lang.String getOriginalConfigurationText()
        Returns the original configuration text for this CacheManager
        Returns:
        Returns the original configuration text for this CacheManager
      • getActiveConfigurationText

        public java.lang.String getActiveConfigurationText()
        Returns the active configuration text for this CacheManager
        Returns:
        Returns the active configuration text for this CacheManager
      • getOriginalConfigurationText

        public java.lang.String getOriginalConfigurationText​(java.lang.String cacheName)
                                                      throws CacheException
        Returns the original configuration text for the input cacheName
        Parameters:
        cacheName -
        Returns:
        Returns the original configuration text for the input cacheName
        Throws:
        CacheException - if the cache with cacheName does not exist in the original config
      • getActiveConfigurationText

        public java.lang.String getActiveConfigurationText​(java.lang.String cacheName)
                                                    throws CacheException
        Returns the active configuration text for the input cacheName
        Parameters:
        cacheName -
        Returns:
        Returns the active configuration text for the input cacheName
        Throws:
        CacheException - if the cache with cacheName does not exist
      • getConfiguration

        public Configuration getConfiguration()
        Get the CacheManager configuration
        Returns:
        the configuration
      • addCacheIfAbsent

        public Ehcache addCacheIfAbsent​(Ehcache cache)
        Only adds the cache to the CacheManager should not one with the same name already be present
        Parameters:
        cache - The Ehcache to be added
        Returns:
        the instance registered with the CacheManager, the cache instance passed in if it was added; or null if Ehcache is null
      • addCacheIfAbsent

        public Ehcache addCacheIfAbsent​(java.lang.String cacheName)
        Only creates and adds the cache to the CacheManager should not one with the same name already be present
        Parameters:
        cacheName - the name of the Cache to be created
        Returns:
        the Ehcache instance created and registered; null if cacheName was null or of length 0
      • getTransactionController

        public TransactionController getTransactionController()
        Get the TransactionController
        Returns:
        the TransactionController
      • getOrCreateTransactionIDFactory

        public TransactionIDFactory getOrCreateTransactionIDFactory()
        Get or create a TransactionIDFactory
        Returns:
        a TransactionIDFactory
      • getFeaturesManager

        public FeaturesManager getFeaturesManager()
        Get the features manager.
        Returns:
        the features manager
      • sendManagementEvent

        public void sendManagementEvent​(java.io.Serializable event,
                                        java.lang.String type)
        Send a management event to the cluster
        Parameters:
        event - , the event (most probably an EventEntity)
        type - , the type of the event