Class CacheManager

  • All Implemented Interfaces:
    CacheManagerMBean

    public class CacheManager
    extends java.lang.Object
    implements CacheManagerMBean
    An MBean implementation for those attributes and operations we wish to expose on net.sf.ehcache.CacheManager. This class is not Serializable because it is an adapter around a net.sf.ehcache.CacheManager, which is itself not Serializable.
    Since:
    1.3
    Version:
    $Id$
    Author:
    Greg Luck
    • Constructor Summary

      Constructors 
      Constructor Description
      CacheManager​(CacheManager cacheManager)
      Create a management CacheManager
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void clearAll()
      Clears the contents of all caches in the CacheManager, but without removing any caches.
      Cache getCache​(java.lang.String name)
      Returns a JMX Cache bean
      java.lang.String[] getCacheNames()
      Gets the cache names managed by the CacheManager
      java.util.List getCaches()
      Gets a list of caches in this CacheManager
      java.lang.String getName()
      Gets the name of the CacheManager
      java.lang.String getStatus()
      Gets the status attribute of the Ehcache
      long getTransactionCommittedCount()
      Get the committed transactions count
      long getTransactionRolledBackCount()
      Get the rolled back transactions count
      long getTransactionTimedOutCount()
      Get the timed out transactions count.
      void shutdown()
      Shuts down the CacheManager.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • getStatus

        public java.lang.String getStatus()
        Gets the status attribute of the Ehcache
        Specified by:
        getStatus in interface CacheManagerMBean
        Returns:
        The status value, as a String from the Status enum class
      • getName

        public java.lang.String getName()
        Gets the name of the CacheManager
        Specified by:
        getName in interface CacheManagerMBean
        Returns:
        The cache manager name, which may not be set
      • 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.

        Specified by:
        shutdown in interface CacheManagerMBean
      • clearAll

        public void clearAll()
        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.

        Specified by:
        clearAll in interface CacheManagerMBean
      • getCacheNames

        public java.lang.String[] getCacheNames()
                                         throws java.lang.IllegalStateException
        Gets the cache names managed by the CacheManager
        Specified by:
        getCacheNames in interface CacheManagerMBean
        Throws:
        java.lang.IllegalStateException
      • getCaches

        public java.util.List getCaches()
        Gets a list of caches in this CacheManager
        Specified by:
        getCaches in interface CacheManagerMBean
        Returns:
        a list of JMX Cache objects
      • getTransactionCommittedCount

        public long getTransactionCommittedCount()
        Get the committed transactions count
        Specified by:
        getTransactionCommittedCount in interface CacheManagerMBean
        Returns:
        the committed transactions count
      • getTransactionRolledBackCount

        public long getTransactionRolledBackCount()
        Get the rolled back transactions count
        Specified by:
        getTransactionRolledBackCount in interface CacheManagerMBean
        Returns:
        the rolled back transactions count
      • getTransactionTimedOutCount

        public long getTransactionTimedOutCount()
        Get the timed out transactions count. Note that only transactions which failed to commit due to a timeout are taken into account
        Specified by:
        getTransactionTimedOutCount in interface CacheManagerMBean
        Returns:
        the timed out transactions count