⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 index.xtp

📁 RESIN 3.2 最新源码
💻 XTP
字号:
<document>  <header>    <product>resin</product>    <title>Using MBeanRegistration</title>    <type>tutorial</type>    <description>      <p>      MBeans can implement the MBeanRegistration interface to find the      ObjectName and MBeanServer they're registered with.      </p>    </description> <tutorial-startpage>index.jsp</tutorial-startpage>  </header><body><summary/><s1 title="Files in this tutorial"><deftable><tr><td><viewfile-link file="WEB-INF/web.xml"/>    </td><td>Configures the JMX-managed bean</td></tr><tr><td><viewfile-link file="WEB-INF/classes/example/Test.java"/>    </td><td>The resource bean implementation.</td></tr><tr><td><viewfile-link file="WEB-INF/classes/example/TestMBean.java"/>    </td><td>The management interface for the bean.</td></tr><tr><td><viewfile-link file="index.jsp"/>    </td><td>Using the managed bean.</td></tr></deftable></s1><s1 title="MBeanRegistration"><p>Frequently, a managed bean will either needits <code>ObjectName</code> or its <code>MBeanServer</code>.  When thebean implements the <code>MBeanRegistration</code> interface, theJMX server tells the bean its <code>ObjectName</code> on registration.</p><p>The bean can verify the <code>ObjectName</code> or evenreturning a different name, although returning a different<code>ObjectName</code> is generally a bad idea in most cases since itmakes the to configure.</p><example title="Test.java">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()  {  }}</example><s2 title="Client"><p>The client JSP asks for the object's ObjectName to see the ObjectNamepassed in the <code>preRegistration</code> call.</p><example title="index.jsp">&lt;%@ page import='com.caucho.jmx.Jmx, example.BasicMBean' %&gt;&lt;%BasicMBean basic = (BasicMBean) Jmx.find("example:name=test");out.println("ObjectName: " + test.getObjectName());%&gt;</example><results>ObjectName: example:name=test</results></s2></s1><s1 title="Compatibility"><p>MBeanRegistration is part of the JMX specification.</p></s1>  </body></document>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -