org.jboss.cache.jmx
Class JmxRegistrationManager

java.lang.Object
  extended by org.jboss.cache.jmx.JmxRegistrationManager

public class JmxRegistrationManager
extends Object

Registers all the MBeans from an Cache instance to a MBeanServer. It iterates over all the components within ComponentRegistry and registers all the components annotated with ManagedAttribute, ManagedOperation or/and MBean. If no MBean server is provided, then the ManagementFactory.getPlatformMBeanServer() is being used.

It is immutable: both cache instance and MBeanServer are being passed as arguments to the constructor.

Note that by default object names used are prefixed with jboss.cache:service=JBossCache. While this format works for and is consistent with JBoss AS and the JMX console, it has been known to cause problems with other JMX servers such as Websphere. To work around this, you can provide the following VM system property to override this prefix with a prefix of your choice: -Djbosscache.jmx.prefix=JBossCache

Since:
3.0
Author:
Mircea.Markus@jboss.com, Galder Zamarreno

Field Summary
static String JMX_RESOURCE_KEY
          Key for every Dynamic mbean added.
static String LOCAL_CACHE_PREFIX
          default ObjectName for non clustered caches.
static String REPLICATED_CACHE_PREFIX
          default ObjectName for clusterd caches.
 
Constructor Summary
JmxRegistrationManager(Cache cache)
           
JmxRegistrationManager(Cache cache, ObjectName objectNameBase)
          Defaults to platform to platform MBeanServer.
JmxRegistrationManager(MBeanServer mBeanServer, Cache cache, ObjectName objectNameBase)
          C-tor.
JmxRegistrationManager(MBeanServer mBeanServer, Cache cache, String objectNameBase)
           
 
Method Summary
 String getObjectName(String resourceName)
           
 String getObjectNameBase()
           
 void registerAllMBeans()
          Performs the MBean registration.
 void unregisterAllMBeans()
          Unregisters all the MBeans registered through registerAllMBeans().
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

REPLICATED_CACHE_PREFIX

public static final String REPLICATED_CACHE_PREFIX
default ObjectName for clusterd caches. Cluster name should pe appended.


LOCAL_CACHE_PREFIX

public static final String LOCAL_CACHE_PREFIX
default ObjectName for non clustered caches. An unique identifier should be appended.


JMX_RESOURCE_KEY

public static final String JMX_RESOURCE_KEY
Key for every Dynamic mbean added.

See Also:
Constant Field Values
Constructor Detail

JmxRegistrationManager

public JmxRegistrationManager(MBeanServer mBeanServer,
                              Cache cache,
                              ObjectName objectNameBase)
C-tor.

Parameters:
mBeanServer - the server where mbeans are being registered
cache - cache that needs to be monitored
objectNameBase - path in the MBeanServer where to register cache MBeans

JmxRegistrationManager

public JmxRegistrationManager(MBeanServer mBeanServer,
                              Cache cache,
                              String objectNameBase)
Throws:
IllegalArgumentException - if the supplied objectNameBase name isn't valid
See Also:
JmxRegistrationManager(javax.management.MBeanServer, org.jboss.cache.Cache, javax.management.ObjectName)

JmxRegistrationManager

public JmxRegistrationManager(Cache cache,
                              ObjectName objectNameBase)
Defaults to platform to platform MBeanServer.

See Also:
ManagementFactory.getPlatformMBeanServer(), platform MBeanServer

JmxRegistrationManager

public JmxRegistrationManager(Cache cache)
Method Detail

registerAllMBeans

public void registerAllMBeans()
                       throws CacheException
Performs the MBean registration.

Throws:
CacheException

unregisterAllMBeans

public void unregisterAllMBeans()
                         throws CacheException
Unregisters all the MBeans registered through registerAllMBeans().

Throws:
CacheException

getObjectName

public String getObjectName(String resourceName)

getObjectNameBase

public String getObjectNameBase()


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