using mbeanregistration
MBeans can implement the MBeanRegistration interface to find the ObjectName and MBeanServer they're registered with.
Frequently, a managed bean will either need
its The bean can verify the package example; import javax.management.ObjectName; import javax.management.MBeanServer; import javax.management.MBeanRegistration; public class Test implements TestMBean, MBeanRegistration { private ObjectName _name; public ObjectName getObjectName() { return _name; } public ObjectName preRegister(MBeanServer server, ObjectName name) throws Exception { _name = name; return name; } public void postRegister(Boolean registrationDone) { } public void preDeregister() throws Exception { } public void postDeregister() { } } ClientThe client JSP asks for the object's ObjectName to see the ObjectName
passed in the <%@ page import='com.caucho.jmx.Jmx, example.BasicMBean' %> <% BasicMBean basic = (BasicMBean) Jmx.find("example:name=test"); out.println("ObjectName: " + test.getObjectName()); %> ObjectName: example:name=test MBeanRegistration is part of the JMX specification.
|