Class JCSAdminBean

java.lang.Object
org.apache.commons.jcs3.admin.JCSAdminBean
All Implemented Interfaces:
JCSJMXBean

public class JCSAdminBean extends Object implements JCSJMXBean
A servlet which provides HTTP access to JCS. Allows a summary of regions to be viewed, and removeAll to be run on individual regions or all regions. Also provides the ability to remove items (any number of key arguments can be provided with action 'remove'). Should be initialized with a properties file that provides at least a classpath resource loader.
  • Constructor Details

  • Method Details

    • buildElementInfo

      Builds up info about each element in a region.

      Specified by:
      buildElementInfo in interface JCSJMXBean
      Parameters:
      cacheName -
      Returns:
      List of CacheElementInfo objects
      Throws:
      IOException
    • buildCacheInfo

      Builds up data on every region.

      TODO we need a most light weight method that does not count bytes. The byte counting can really swamp a server.

      Specified by:
      buildCacheInfo in interface JCSJMXBean
      Returns:
      List of CacheRegionInfo objects
    • getByteCount

      public long getByteCount(String cacheName)
      Tries to estimate how much data is in a region. This is expensive. If there are any non serializable objects in the region or an error occurs, suppresses exceptions and returns 0.

      Specified by:
      getByteCount in interface JCSJMXBean
      Returns:
      int The size of the region in bytes.
    • getByteCount

      public <K, V> long getByteCount(CompositeCache<K,V> cache)
      Tries to estimate how much data is in a region. This is expensive. If there are any non serializable objects in the region or an error occurs, suppresses exceptions and returns 0.

      Returns:
      int The size of the region in bytes.
    • clearAllRegions

      public void clearAllRegions() throws IOException
      Clears all regions in the cache.

      If this class is running within a remote cache server, clears all regions via the RemoteCacheServer API, so that removes will be broadcast to client machines. Otherwise clears all regions in the cache directly via the usual cache API.

      Specified by:
      clearAllRegions in interface JCSJMXBean
      Throws:
      IOException
    • clearRegion

      public void clearRegion(String cacheName) throws IOException
      Clears a particular cache region.

      If this class is running within a remote cache server, clears the region via the RemoteCacheServer API, so that removes will be broadcast to client machines. Otherwise clears the region directly via the usual cache API.

      Specified by:
      clearRegion in interface JCSJMXBean
      Throws:
      IOException
    • removeItem

      public void removeItem(String cacheName, String key) throws IOException
      Removes a particular item from a particular region.

      If this class is running within a remote cache server, removes the item via the RemoteCacheServer API, so that removes will be broadcast to client machines. Otherwise clears the region directly via the usual cache API.

      Specified by:
      removeItem in interface JCSJMXBean
      Parameters:
      cacheName -
      key -
      Throws:
      IOException