[jboss-user] [JBossCache] - Re: How to access TreeCache from MBean ?

bstansberry@jboss.com do-not-reply at jboss.com
Tue Mar 27 11:34:22 EDT 2007


You're in luck in that a JBoss utility class for simplifying dealing with JMX happens to be in a jar that JBC depends on.  So, assuming your cache was somehow created and registered in MBeanServer 'server' under ObjectName 'name':


  | TreeCacheMBean cache = (TreeCacheMBean) org.jboss.mx.util.MBeanProxyExt.create(TreeCacheMBean.class, name.getCanonicalName(), server);
  | 
  | // Only do this if whatever bound your cache in JMX didn't start it!!!
  | cache.startService();
  | 
  | cache.put("/a/b/c", map);
  | 

What you're doing here is creating a proxy that delegates calls to the JMX server, which routes them to your mbean.

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

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



More information about the jboss-user mailing list