ehcache

net.sf.ehcache.management
Class CacheManager

java.lang.Object
  extended by net.sf.ehcache.management.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: CacheManager.java 523 2007-07-30 11:23:19Z gregluck $
Author:
Greg Luck

Constructor Summary
CacheManager(CacheManager cacheManager)
          Create a management CacheManager
 
Method Summary
 void clearAll()
          Clears the contents of all caches in the CacheManager, but without removing any caches.
(package private) static javax.management.ObjectName createObjectName(CacheManager cacheManager)
          Creates an object name using the scheme "net.sf.ehcache:type=CacheManager,name="
 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
(package private)  javax.management.ObjectName getObjectName()
           
 java.lang.String getStatus()
          Gets the status attribute of the Ehcache
 void shutdown()
          Shuts down the CacheManager.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CacheManager

public CacheManager(CacheManager cacheManager)
             throws CacheException
Create a management CacheManager

Parameters:
cacheManager -
Throws:
CacheException
Method Detail

createObjectName

static javax.management.ObjectName createObjectName(CacheManager cacheManager)
Creates an object name using the scheme "net.sf.ehcache:type=CacheManager,name="


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

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

getCache

public Cache getCache(java.lang.String name)
Returns a JMX Cache bean

Specified by:
getCache 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

getObjectName

javax.management.ObjectName getObjectName()
Returns:
the object name for this MBean

ehcache