JBoss.org Community Documentation
JBoss Cache captures statistics in its interceptors and exposes the statistics through interceptor
MBeans. Gathering of statistics is enabled by default; this can be disabled for a specific cache
instance through the
ExposeManagementStatistics
configuration attribute. Note that
the majority of the statistics are provided by the
CacheMgmtInterceptor
,
so this MBean is the most significant in this regard. If you want to disable all statistics for performance
reasons, you set
ExposeManagementStatistics
to
false
as this will
prevent the
CacheMgmtInterceptor
from being included in the cache's interceptor stack
when the cache is started.
If a
CacheJmxWrapper
is registered with JMX, the wrapper also ensures that
an MBean is registered in JMX for each interceptor that exposes statistics
[4]
.
Management tools can then access those MBeans to examine the statistics. See the section in the
JMX Reference chapter
pertaining to the
statistics that are made available via JMX.
The name under which the interceptor MBeans will be registered is derived by taking the
ObjectName
under which the
CacheJmxWrapper
is
registered and adding a
cache-interceptor
attribute key whose value
is the non-qualified name of the interceptor class. So, for example, if the
CacheJmxWrapper
were registered under
jboss.cache:service=TreeCache
, the name of the
CacheMgmtInterceptor
MBean would be
jboss.cache:service=TreeCache,cache-interceptor=CacheMgmtInterceptor
.
Each interceptor's MBean exposes a
StatisticsEnabled
attribute that can be used to disable maintenance of statistics for
that interceptor. In addition, each interceptor MBean provides the following common operations and
attributes.
dumpStatistics
- returns a
Map
containing the interceptor's attributes and values.
resetStatistics
- resets all statistics maintained by the interceptor.
setStatisticsEnabled(boolean)
- allows statistics to be disabled for a specific interceptor.
[4]
Note that if the
CacheJmxWrapper
is not registered in JMX, the
interceptor MBeans will not be registered either. The JBoss Cache 1.4 releases
included code that would try to "discover" an
MBeanServer
and
automatically register the interceptor MBeans with it. For JBoss Cache 2.x we decided
that this sort of "discovery" of the JMX environment was beyond the proper scope of
a caching library, so we removed this functionality.