Java Reference
In-Depth Information
Registering the MBean in the JMXBookAgent
Recall from previous chapters that you have created setup classes in order to
place MBeans into your JMXBookAgent agent. Listing 13.4 shows the JMSSetup
class, which registers an instance of the JMSController MBean.
Listing 13.4
JMSSetup.java
package jmxbook.ch13;
import jmxbook.ch3.RMIClientFactory;
import java.util.*;
import java.io.*;
import java.net.*;
import com.sun.jdmk.comm.*;
import javax.management.Attribute;
import javax.management.ObjectName;
import javax.management.MBeanServer;
import javax.management.MBeanServerFactory;
import javax.management.MBeanInfo;
import javax.management.MBeanAttributeInfo;
import javax.management.MBeanConstructorInfo;
import javax.management.MBeanOperationInfo;
import javax.management.MBeanNotificationInfo;
import javax.management.MBeanParameterInfo;
import javax.management.MalformedObjectNameException;
import javax.management.MBeanException;
public class JMSSetup
{
private RmiConnectorClient client = null;
public JMSSetup()
{
System.out.println("\n\tCONNECT to the MBeanServer.");
client = RMIClientFactory.getClient();
System.out.println("\n\tGot RMI Client.");
}
public void createMBeans()
{
try
{
System.out.println("\n>>> REGISTERING JMS MBean");
//register the JMS Controller MBean
System.out.println("\n>>> REGISTERING JMS Controller MBean");
ObjectName JMSBeanName=new ObjectName(
"JMXBookAgent:name=JMS_Controller_Bean" );
client.createMBean( "jmxbook.ch13.JMSController",
JMSBeanName );
}
Search WWH ::




Custom Search