[jboss-user] [JBoss Cache: Core Edition] - Registration of Cache MBean for JMX?

MPreukschat do-not-reply at jboss.com
Tue May 26 07:09:05 EDT 2009


Hi all,

I'm working on a thesis about simulation and evaluation of distributed caching and I would like to use the standalone version of the JBoss Cache for this purpose. Now I have some questions regarding the registration of the MBeans to JMX.

The userguide for 3.0.0GA "Naga" 

/http://www.jboss.org/file-access/default/members/jbosscache/freezone/docs/3.0.3.GA/userguide_en/html/deployment.html#jmx.registration/

shows two different solutions for this:

The first one (Registration with an existing cache instance) has been implemented by me like this:



  | 
  |   //CacheFactory factory = new DefaultCacheFactory();
  | 
  |      Cache cache = factory.createCache("total-replication.xml");
  |  
  |   //Creating MBean Server for JMX-Manager
  | 
  |      MBeanServer server =  
  |      MBeanServerFactory.createMBeanServer("jboss.cache");
  |      ObjectName on = null;
  |  
  |   //I don't know why I need a  try/catch-block right here, but ObjectName on = new ObjectName("jboss.cache:service=Cache"); is throwing an exception without it?!
  | 
  |       try {
  |                on = new ObjectName("jboss.cache:service=Cache");
  |         } catch (MalformedObjectNameException e)  
  |        {                                             
  |            e.printStackTrace();
  |         } catch (NullPointerException e) 
  |         {
  |            e.printStackTrace();
  |        }
  |            JmxRegistrationManager jmxManager = new  
  |            JmxRegistrationManager(server, cache, on);
  |            jmxManager.registerAllMBeans();
  | 
  |  

After that I'm fetching some information about the objects via toString() (what exactly is the MBean Count from the MBeanServer?):


ObjectName:
       Domain: jboss.cache
       PropertyList: service=Cache
       Object toString: jboss.cache:service=Cache

jmxManager:
     Object NameBase: jboss.cache:service=Cache
     Object toString:  org.jboss.cache.jmx.JmxRegistrationManager at d66426

MBeanServer:
   MBeanCount: 8
   Server toString: com.sun.jmx.mbeanserver.JmxMBeanServer at 1490eb5/

Creating the cache via the "CacheJmxWrapper" is the second solution in the usermanual. Regarding the example with this wrapper I ran into some trouble when creating the wrapper. First of all, there seems not to be a constructor which is accepting a Configuration Object like in the example:


  |        CacheJmxWrapperMBean wrapper = new CacheJmxWrapper(config);
  | 

Furthermore, the "CacheJmxWrapper" will not be supported anymore since API Version 3.0 and will be replaced by the "JmxRegistrationManager".

http://www.jboss.org/file-access/default/members/jbosscache/freezone/docs/3.0.3.GA/apidocs/index.html/

The "CacheJmxWrapper" is signed as deprecated. Is it still recommended to use it and how do I create it without using the Configuration object in the constructor?

A similar question regarding the wrapper was has been raised in this thread: 

http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4211605#4211605

Thanks for your help!
Cheers,

Marcel

View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4233270#4233270

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4233270



More information about the jboss-user mailing list