org.jboss.cache.interceptors
Class CacheMgmtInterceptor

java.lang.Object
  extended by org.jboss.cache.interceptors.Interceptor
      extended by org.jboss.cache.interceptors.CacheMgmtInterceptor
All Implemented Interfaces:
javax.management.NotificationBroadcaster, CacheMgmtInterceptorMBean, InterceptorMBean

public class CacheMgmtInterceptor
extends Interceptor
implements CacheMgmtInterceptorMBean, javax.management.NotificationBroadcaster

Captures cache management statistics

Version:
$Id: CacheMgmtInterceptor.java,v 1.12 2006/03/15 16:02:38 genman Exp $
Author:
Jerry Gauthier

Field Summary
static java.lang.String NOTIF_CACHE_STARTED
           
static java.lang.String NOTIF_CACHE_STOPPED
           
static java.lang.String NOTIF_NODE_ACTIVATE
           
static java.lang.String NOTIF_NODE_CREATED
           
static java.lang.String NOTIF_NODE_EVICT
           
static java.lang.String NOTIF_NODE_EVICTED
           
static java.lang.String NOTIF_NODE_LOADED
           
static java.lang.String NOTIF_NODE_MODIFIED
           
static java.lang.String NOTIF_NODE_MODIFY
           
static java.lang.String NOTIF_NODE_PASSIVATE
           
static java.lang.String NOTIF_NODE_REMOVE
           
static java.lang.String NOTIF_NODE_REMOVED
           
static java.lang.String NOTIF_NODE_VISITED
           
static java.lang.String NOTIF_VIEW_CHANGE
           
 
Constructor Summary
CacheMgmtInterceptor()
           
 
Method Summary
 void addNotificationListener(javax.management.NotificationListener listener, javax.management.NotificationFilter filter, java.lang.Object handback)
           
 java.util.Map dumpStatistics()
          Returns a map of the cache interceptor's statistics Map elements consist of {String name, Object value} entries
 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
 javax.management.MBeanNotificationInfo[] getNotificationInfo()
           
 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
 java.lang.Object invoke(org.jgroups.blocks.MethodCall m)
          Pass the method on and capture cache statistics
 void removeNotificationListener(javax.management.NotificationListener listener)
           
 void removeNotificationListener(javax.management.NotificationListener listener, javax.management.NotificationFilter filter, java.lang.Object handback)
           
 void resetStatistics()
          Resets an interceptor's cache statistics
 void setCache(TreeCache cache)
           
 
Methods inherited from class org.jboss.cache.interceptors.Interceptor
getInvocationContext, getNext, getStatisticsEnabled, isActive, isOnePhaseCommitPrepareMehod, isPreparing, isTransactionLifecycleMethod, isValid, setInvocationContext, setNext, setStatisticsEnabled
 
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
 

Field Detail

NOTIF_CACHE_STARTED

public static final java.lang.String NOTIF_CACHE_STARTED
See Also:
Constant Field Values

NOTIF_CACHE_STOPPED

public static final java.lang.String NOTIF_CACHE_STOPPED
See Also:
Constant Field Values

NOTIF_NODE_CREATED

public static final java.lang.String NOTIF_NODE_CREATED
See Also:
Constant Field Values

NOTIF_NODE_EVICTED

public static final java.lang.String NOTIF_NODE_EVICTED
See Also:
Constant Field Values

NOTIF_NODE_LOADED

public static final java.lang.String NOTIF_NODE_LOADED
See Also:
Constant Field Values

NOTIF_NODE_MODIFIED

public static final java.lang.String NOTIF_NODE_MODIFIED
See Also:
Constant Field Values

NOTIF_NODE_REMOVED

public static final java.lang.String NOTIF_NODE_REMOVED
See Also:
Constant Field Values

NOTIF_NODE_VISITED

public static final java.lang.String NOTIF_NODE_VISITED
See Also:
Constant Field Values

NOTIF_VIEW_CHANGE

public static final java.lang.String NOTIF_VIEW_CHANGE
See Also:
Constant Field Values

NOTIF_NODE_ACTIVATE

public static final java.lang.String NOTIF_NODE_ACTIVATE
See Also:
Constant Field Values

NOTIF_NODE_EVICT

public static final java.lang.String NOTIF_NODE_EVICT
See Also:
Constant Field Values

NOTIF_NODE_MODIFY

public static final java.lang.String NOTIF_NODE_MODIFY
See Also:
Constant Field Values

NOTIF_NODE_PASSIVATE

public static final java.lang.String NOTIF_NODE_PASSIVATE
See Also:
Constant Field Values

NOTIF_NODE_REMOVE

public static final java.lang.String NOTIF_NODE_REMOVE
See Also:
Constant Field Values
Constructor Detail

CacheMgmtInterceptor

public CacheMgmtInterceptor()
Method Detail

setCache

public void setCache(TreeCache cache)
Overrides:
setCache in class Interceptor

invoke

public java.lang.Object invoke(org.jgroups.blocks.MethodCall m)
                        throws java.lang.Throwable
Pass the method on and capture cache statistics

Overrides:
invoke in class Interceptor
Parameters:
m -
Returns:
Throws:
java.lang.Throwable

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
See Also:
TreeCacheMBean.getNumberOfAttributes()

getNumberOfNodes

public int getNumberOfNodes()
Specified by:
getNumberOfNodes in interface CacheMgmtInterceptorMBean
See Also:
TreeCacheMBean.getNumberOfNodes()

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 java.util.Map dumpStatistics()
Description copied from interface: InterceptorMBean
Returns a map of the cache interceptor's statistics Map elements consist of {String name, Object value} entries

Specified by:
dumpStatistics in interface InterceptorMBean
Overrides:
dumpStatistics in class Interceptor
Returns:
a map containing statistics

resetStatistics

public void resetStatistics()
Description copied from interface: InterceptorMBean
Resets an interceptor's cache statistics

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

removeNotificationListener

public void removeNotificationListener(javax.management.NotificationListener listener,
                                       javax.management.NotificationFilter filter,
                                       java.lang.Object handback)
                                throws javax.management.ListenerNotFoundException
Throws:
javax.management.ListenerNotFoundException

getNotificationInfo

public javax.management.MBeanNotificationInfo[] getNotificationInfo()
Specified by:
getNotificationInfo in interface javax.management.NotificationBroadcaster

addNotificationListener

public void addNotificationListener(javax.management.NotificationListener listener,
                                    javax.management.NotificationFilter filter,
                                    java.lang.Object handback)
                             throws java.lang.IllegalArgumentException
Specified by:
addNotificationListener in interface javax.management.NotificationBroadcaster
Throws:
java.lang.IllegalArgumentException

removeNotificationListener

public void removeNotificationListener(javax.management.NotificationListener listener)
                                throws javax.management.ListenerNotFoundException
Specified by:
removeNotificationListener in interface javax.management.NotificationBroadcaster
Throws:
javax.management.ListenerNotFoundException


Copyright © 1998-2005 JBoss Inc . All Rights Reserved.