📄 test.java
字号:
package example;import javax.management.ObjectName;import javax.management.MBeanServer;import javax.management.MBeanRegistration;/** * Implements a resource which is a plain-old bean, which exposes * the <code>getData()</code> method as a JMX-managed attribute. */public class Test implements TestMBean, MBeanRegistration { /** * The bean's name. */ private ObjectName _name; /** * Gets the name. */ public ObjectName getObjectName() { return _name; } /** * Called before the registration. * * @param server the mbean server to be registered * @param name the client's name to be registered * * @return the name the object wans the be registered as */ public ObjectName preRegister(MBeanServer server, ObjectName name) throws Exception { _name = name; return name; } /** * Called after the registration. * * @param registrationDone true if the registration was successful. */ public void postRegister(Boolean registrationDone) { } /** * Called before deregistration. */ public void preDeregister() throws Exception { } /** * Called after the deregistration. */ public void postDeregister() { } /** * Returns a printable version of the resource. */ public String toString() { return "Test[" + _name + "]"; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -