info.magnolia.module.cache.mbean
Class CacheMonitor

java.lang.Object
  extended by info.magnolia.module.cache.mbean.CacheMonitor
All Implemented Interfaces:
CacheMonitorMBean

public class CacheMonitor
extends java.lang.Object
implements CacheMonitorMBean

MBean implementation for the cache status.

Version:
$Id:$
Author:
had

Constructor Summary
CacheMonitor()
           
 
Method Summary
 void addCache(java.lang.String name)
           
 void countFlush(java.lang.String name)
           
 void countStart()
           
 void flushAll()
          Will flush all entries from all configured caches.
 void flushByUUID(java.lang.String repository, java.lang.String uuid)
          Will flush all entries with key bound to given uuid from all configured caches.
 java.util.Map<java.lang.String,java.lang.Integer> getAll()
           
 int getBypasses()
          Gets number of times since the last server restart the caching policy decided to bypass cache and serve request out of repository (i.e.
 int getCachedKeysCount()
          Gets number of entries in all known caches even if those entries have been generated from content with same uuid (e.g.
 int getCachedUUIDsCount()
          Gets number of content uuids that are held in all known caches.
 java.util.Map<java.lang.String,java.lang.Integer> getDomainAccesses()
          Gets number of times the requests have been served for each configured domain since the last server restart.
 java.util.Map<java.lang.String,java.lang.Integer> getFlushes()
          Gets number of times each configured cache have been flushed since the last server restart.
 int getHits()
          Gets number of times since the last server restart the cache found and served the entry requested by client.
static CacheMonitor getInstance()
           
 int getPuts()
          Gets number of times since the last server restart the cached entry for the request didn't exist and was put in the cache.
 int getStartCalls()
          Gets number of times Cache Module was started since the last server restart.
 int getStopCalls()
          Gets number of times Cache Module was stopped since the last server restart.
 void logAccess(java.lang.Object cacheKey)
           
 void logBehavior(java.lang.String name)
           
 void stop()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CacheMonitor

public CacheMonitor()
Method Detail

getInstance

public static CacheMonitor getInstance()

countStart

public void countStart()

stop

public void stop()

logBehavior

public void logBehavior(java.lang.String name)
Parameters:
name -

countFlush

public void countFlush(java.lang.String name)

addCache

public void addCache(java.lang.String name)

logAccess

public void logAccess(java.lang.Object cacheKey)

flushAll

public void flushAll()
              throws java.lang.Exception
Description copied from interface: CacheMonitorMBean
Will flush all entries from all configured caches.

Specified by:
flushAll in interface CacheMonitorMBean
Throws:
java.lang.Exception

flushByUUID

public void flushByUUID(java.lang.String repository,
                        java.lang.String uuid)
                 throws java.lang.Exception
Description copied from interface: CacheMonitorMBean
Will flush all entries with key bound to given uuid from all configured caches. In multi domain and multi locale environments, it will flush all domain and language variations of the page with given UUID from all caches.

Specified by:
flushByUUID in interface CacheMonitorMBean
Throws:
java.lang.Exception

getAll

public java.util.Map<java.lang.String,java.lang.Integer> getAll()
Specified by:
getAll in interface CacheMonitorMBean

getHits

public int getHits()
Description copied from interface: CacheMonitorMBean
Gets number of times since the last server restart the cache found and served the entry requested by client.

Specified by:
getHits in interface CacheMonitorMBean
Returns:
number of cache hits.

getBypasses

public int getBypasses()
Description copied from interface: CacheMonitorMBean
Gets number of times since the last server restart the caching policy decided to bypass cache and serve request out of repository (i.e. for dynamic content).

Specified by:
getBypasses in interface CacheMonitorMBean
Returns:
number of cache bypasses.

getPuts

public int getPuts()
Description copied from interface: CacheMonitorMBean
Gets number of times since the last server restart the cached entry for the request didn't exist and was put in the cache.

Specified by:
getPuts in interface CacheMonitorMBean
Returns:

getStopCalls

public int getStopCalls()
Description copied from interface: CacheMonitorMBean
Gets number of times Cache Module was stopped since the last server restart.

Specified by:
getStopCalls in interface CacheMonitorMBean
Returns:
number of Cache Module stop() calls.

getStartCalls

public int getStartCalls()
Description copied from interface: CacheMonitorMBean
Gets number of times Cache Module was started since the last server restart.

Specified by:
getStartCalls in interface CacheMonitorMBean
Returns:
number of Cache Module start() calls.

getFlushes

public java.util.Map<java.lang.String,java.lang.Integer> getFlushes()
Description copied from interface: CacheMonitorMBean
Gets number of times each configured cache have been flushed since the last server restart.

Specified by:
getFlushes in interface CacheMonitorMBean
Returns:
names of caches and number of times each of them have been completely flushed.

getDomainAccesses

public java.util.Map<java.lang.String,java.lang.Integer> getDomainAccesses()
Description copied from interface: CacheMonitorMBean
Gets number of times the requests have been served for each configured domain since the last server restart. If the name of the domain doesn't appear in the list, no request have been served for this domain since the restart, yet.

Specified by:
getDomainAccesses in interface CacheMonitorMBean
Returns:
names of the domains and number of times the requests have been server for each of them.

getCachedKeysCount

public int getCachedKeysCount()
Description copied from interface: CacheMonitorMBean
Gets number of entries in all known caches even if those entries have been generated from content with same uuid (e.g. multiple language versions or multiple domain versions).

Specified by:
getCachedKeysCount in interface CacheMonitorMBean
Returns:
number of entries held by all caches.

getCachedUUIDsCount

public int getCachedUUIDsCount()
Description copied from interface: CacheMonitorMBean
Gets number of content uuids that are held in all known caches. There might be multiple entries per uuid in case multi-domain and/or multi-locale configurations are used.

Specified by:
getCachedUUIDsCount in interface CacheMonitorMBean
Returns:
number of unique content entries that are held in cache.


Copyright © 2003-2010 Magnolia International Ltd.. All Rights Reserved.