[jboss-user] [JBoss Cache: Core Edition] - How to replace CacheJmxWrapper with JmxRegistrationManager i
alex-jboss69
do-not-reply at jboss.com
Mon Jun 15 11:32:23 EDT 2009
I am using Jboss Cache Core 3.1.0 and Jboss 5.1.
Here is what I need to do:
1 - Deploy the cache using a xml "-jboss-beans.xml" descriptor.
2 - This descriptor must register the cache with the MBeanServer.
3 - Retrieve the cache in my code so I am able to use it.
I am currently doing this as described in section 5.4.2.2 of the documentation ("JMX-Based Deployment in JBoss AS (JBoss AS 5.x)").
<!-- JMX Management -->
| <bean name="ExampleCacheJmxWrapper" class="org.jboss.cache.jmx.CacheJmxWrapper">
| <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss.cache:service=myCache", exposedInterface=org.jboss.cache.jmx.CacheJmxWrapperMBean.class, registerDirectly=true)</annotation>
|
| <constructor>
| <parameter><inject bean="ExampleCache"/></parameter>
| </constructor>
| </bean>
|
Then I retrieve the cache using the following code:
MBeanServer server = MBeanServerLocator.locateJBoss();
| ObjectName on = new ObjectName("jboss.cache:service=myCache");
| @SuppressWarnings("unchecked")
| CacheJmxWrapperMBean<Object, Object> cacheWrapper = (CacheJmxWrapperMBean<Object, Object>) MBeanServerInvocationHandler.newProxyInstance(server, on, CacheJmxWrapperMBean.class, false);
| Cache cache = cacheWrapper.getCache();
It works, but I am using the CacheJmxWrapper and CacheJmxWrapperMBean classes, which are deprecated. The java doc says that the JmxRegistrationManager should be used instead. Can anyone help with that ? The documentation is out of date.
Thanks
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4237689#4237689
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4237689
More information about the jboss-user
mailing list