01 May 2007

Getting an MBeanServer reference with OC4J

Based on some investigative work done this week, a little nugget of information has popped out regarding the best way to get a reference to an MBeanServer from an application deployed to OC4J.

There as two standard methods that can be used to get a reference to an MBeanServer:
When using OC4J, the best approach is to use the newMBeanServer method in preference to the createMBeanServer method.

The newMBeanServer method can be used in two ways:

MBeanServerFactory.newMBeanServer() ;

This will return a reference to the OC4J global MBeanServer that is wrapped with an interceptor that will ensure that all MBeans registered by the application are registered under a domain named after the application, and that all accessed MBeans are either application MBeans, or dependent resources.

MBeanServerFactory.newMBeanServer(String domain);

Will create an application specific MBeanServer with the supplied domain name.

No comments: