org.jboss.cache.interceptors
Class CacheMgmtInterceptor

java.lang.Object
  extended by org.jboss.cache.commands.AbstractVisitor
      extended by org.jboss.cache.interceptors.base.CommandInterceptor
          extended by org.jboss.cache.interceptors.CacheMgmtInterceptor
All Implemented Interfaces:
Visitor, CacheMgmtInterceptorMBean, InterceptorMBean

public class CacheMgmtInterceptor
extends CommandInterceptor
implements CacheMgmtInterceptorMBean

Captures cache management statistics

Version:
$Id: CacheMgmtInterceptor.java 6000 2008-06-17 23:43:54Z manik.surtani@jboss.com $
Author:
Jerry Gauthier

Field Summary
 
Fields inherited from class org.jboss.cache.interceptors.base.CommandInterceptor
configuration, log, trace
 
Constructor Summary
CacheMgmtInterceptor()
           
 
Method Summary
 Map<String,Object> dumpStatistics()
          Returns a map of statistics.
 long getAverageReadTime()
          Returns average milliseconds for an attribute read operation This includes both hits and misses.
 long getAverageWriteTime()
          Returns average milliseconds for an attribute write operation
 long getElapsedTime()
          Returns seconds since cache started
 long getEvictions()
          Returns the number of cache eviction operations
 double getHitMissRatio()
          Returns the hit/miss ratio for the cache This ratio is defined as hits/(hits + misses)
 long getHits()
          Returns the number of cache attribute hits
 long getMisses()
          Returns the number of cache attribute misses
 int getNumberOfAttributes()
           
 int getNumberOfNodes()
           
 double getReadWriteRatio()
          Returns the read/write ratio for the cache This ratio is defined as (hits + misses)/stores
 long getStores()
          Returns the number of cache attribute put operations
 long getTimeSinceReset()
          Returns seconds since cache statistics reset If statistics haven't been reset, this will be the same as ElapsedTime
 void resetStatistics()
          Resets statistics gathered.
 void setDependencies(DataContainer dataContainer)
           
 Object visitEvictFqnCommand(InvocationContext ctx, EvictCommand command)
          Visits a EvictCommand.
 Object visitGetKeyValueCommand(InvocationContext ctx, GetKeyValueCommand command)
          Visits a GetKeyValueCommand.
 Object visitPutDataMapCommand(InvocationContext ctx, PutDataMapCommand command)
          Visits a PutDataMapCommand.
 Object visitPutForExternalReadCommand(InvocationContext ctx, PutForExternalReadCommand command)
          Visits a PutForExternalReadCommand.
 Object visitPutKeyValueCommand(InvocationContext ctx, PutKeyValueCommand command)
          Visits a PutKeyValueCommand.
 
Methods inherited from class org.jboss.cache.interceptors.base.CommandInterceptor
getNext, getStatisticsEnabled, handleDefault, hasNext, invokeNextInterceptor, setNext, setStatisticsEnabled
 
Methods inherited from class org.jboss.cache.commands.AbstractVisitor
visitClearDataCommand, visitCollection, visitCommitCommand, visitCreateNodeCommand, visitExistsNodeCommand, visitGetChildrenNamesCommand, visitGetDataMapCommand, visitGetKeysCommand, visitGetNodeCommand, visitGravitateDataCommand, visitInvalidateCommand, visitMoveCommand, visitOptimisticPrepareCommand, visitPrepareCommand, visitRemoveKeyCommand, visitRemoveNodeCommand, visitRollbackCommand
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jboss.cache.interceptors.InterceptorMBean
getStatisticsEnabled, setStatisticsEnabled
 

Constructor Detail

CacheMgmtInterceptor

public CacheMgmtInterceptor()
Method Detail

setDependencies

public void setDependencies(DataContainer dataContainer)

visitEvictFqnCommand

public Object visitEvictFqnCommand(InvocationContext ctx,
                                   EvictCommand command)
                            throws Throwable
Description copied from interface: Visitor
Visits a EvictCommand.

Specified by:
visitEvictFqnCommand in interface Visitor
Overrides:
visitEvictFqnCommand in class AbstractVisitor
Parameters:
ctx - invocation context
command - command to visit
Returns:
response from the visit
Throws:
Throwable - in the event of problems.

visitGetKeyValueCommand

public Object visitGetKeyValueCommand(InvocationContext ctx,
                                      GetKeyValueCommand command)
                               throws Throwable
Description copied from interface: Visitor
Visits a GetKeyValueCommand.

Specified by:
visitGetKeyValueCommand in interface Visitor
Overrides:
visitGetKeyValueCommand in class AbstractVisitor
Parameters:
ctx - invocation context
command - command to visit
Returns:
response from the visit
Throws:
Throwable - in the event of problems.

visitPutDataMapCommand

public Object visitPutDataMapCommand(InvocationContext ctx,
                                     PutDataMapCommand command)
                              throws Throwable
Description copied from interface: Visitor
Visits a PutDataMapCommand.

Specified by:
visitPutDataMapCommand in interface Visitor
Overrides:
visitPutDataMapCommand in class AbstractVisitor
Parameters:
ctx - invocation context
command - command to visit
Returns:
response from the visit
Throws:
Throwable - in the event of problems.

visitPutForExternalReadCommand

public Object visitPutForExternalReadCommand(InvocationContext ctx,
                                             PutForExternalReadCommand command)
                                      throws Throwable
Description copied from interface: Visitor
Visits a PutForExternalReadCommand.

Specified by:
visitPutForExternalReadCommand in interface Visitor
Overrides:
visitPutForExternalReadCommand in class AbstractVisitor
Parameters:
ctx - invocation context
command - command to visit
Returns:
response from the visit
Throws:
Throwable - in the event of problems.

visitPutKeyValueCommand

public Object visitPutKeyValueCommand(InvocationContext ctx,
                                      PutKeyValueCommand command)
                               throws Throwable
Description copied from interface: Visitor
Visits a PutKeyValueCommand.

Specified by:
visitPutKeyValueCommand in interface Visitor
Overrides:
visitPutKeyValueCommand in class AbstractVisitor
Parameters:
ctx - invocation context
command - command to visit
Returns:
response from the visit
Throws:
Throwable - in the event of problems.

getHits

public long getHits()
Description copied from interface: CacheMgmtInterceptorMBean
Returns the number of cache attribute hits

Specified by:
getHits in interface CacheMgmtInterceptorMBean
Returns:
the number of cache hits

getMisses

public long getMisses()
Description copied from interface: CacheMgmtInterceptorMBean
Returns the number of cache attribute misses

Specified by:
getMisses in interface CacheMgmtInterceptorMBean
Returns:
the number of cache misses

getStores

public long getStores()
Description copied from interface: CacheMgmtInterceptorMBean
Returns the number of cache attribute put operations

Specified by:
getStores in interface CacheMgmtInterceptorMBean
Returns:
the number of cache put operations

getEvictions

public long getEvictions()
Description copied from interface: CacheMgmtInterceptorMBean
Returns the number of cache eviction operations

Specified by:
getEvictions in interface CacheMgmtInterceptorMBean
Returns:
the number of cache eviction operations

getHitMissRatio

public double getHitMissRatio()
Description copied from interface: CacheMgmtInterceptorMBean
Returns the hit/miss ratio for the cache This ratio is defined as hits/(hits + misses)

Specified by:
getHitMissRatio in interface CacheMgmtInterceptorMBean
Returns:
the hit/miss ratio for the cache

getReadWriteRatio

public double getReadWriteRatio()
Description copied from interface: CacheMgmtInterceptorMBean
Returns the read/write ratio for the cache This ratio is defined as (hits + misses)/stores

Specified by:
getReadWriteRatio in interface CacheMgmtInterceptorMBean
Returns:
the read/writes ratio for the cache

getAverageReadTime

public long getAverageReadTime()
Description copied from interface: CacheMgmtInterceptorMBean
Returns average milliseconds for an attribute read operation This includes both hits and misses.

Specified by:
getAverageReadTime in interface CacheMgmtInterceptorMBean
Returns:
the average number of milliseconds for a read operation

getAverageWriteTime

public long getAverageWriteTime()
Description copied from interface: CacheMgmtInterceptorMBean
Returns average milliseconds for an attribute write operation

Specified by:
getAverageWriteTime in interface CacheMgmtInterceptorMBean
Returns:
the average number of milliseconds for a write operation

getNumberOfAttributes

public int getNumberOfAttributes()
Specified by:
getNumberOfAttributes in interface CacheMgmtInterceptorMBean

getNumberOfNodes

public int getNumberOfNodes()
Specified by:
getNumberOfNodes in interface CacheMgmtInterceptorMBean

getElapsedTime

public long getElapsedTime()
Description copied from interface: CacheMgmtInterceptorMBean
Returns seconds since cache started

Specified by:
getElapsedTime in interface CacheMgmtInterceptorMBean
Returns:
the number of seconds since the cache was started

getTimeSinceReset

public long getTimeSinceReset()
Description copied from interface: CacheMgmtInterceptorMBean
Returns seconds since cache statistics reset If statistics haven't been reset, this will be the same as ElapsedTime

Specified by:
getTimeSinceReset in interface CacheMgmtInterceptorMBean
Returns:
the number of seconds since the cache statistics were last reset

dumpStatistics

public Map<String,Object> dumpStatistics()
Description copied from class: CommandInterceptor
Returns a map of statistics. This is a default implementation which returns an empty map and should be overridden if it is to be meaningful.

Specified by:
dumpStatistics in interface InterceptorMBean
Overrides:
dumpStatistics in class CommandInterceptor
Returns:
an empty map

resetStatistics

public void resetStatistics()
Description copied from class: CommandInterceptor
Resets statistics gathered. Is a no-op, and should be overridden if it is to be meaningful.

Specified by:
resetStatistics in interface InterceptorMBean
Overrides:
resetStatistics in class CommandInterceptor


Copyright © 2009 JBoss, a division of Red Hat. All Rights Reserved.