Java Reference
In-Depth Information
public static void main( String[] args )
{
System.out.println("\n>>> START of Relation Service example");
RelationMain example = new RelationMain();
example.createMBeans();
RoleInfo[] roleInfo = example.createRoleInfoArray();
example.createRoles();
;
example.createRelationTypes(roleInfo);
example.createRelation();
System.exit(0);
}
}
11.4 Running the example
You need to perform two tasks to complete the example: run the
JMXBookAgent
class and the
RelationMain
class. To run both, execute the following commands
in this order:
java jmxbook.ch3.JMXBookAgent
java jmxbook.ch11.RelationMain
With the agent still running, and having executed the
RelationMain
class, it is
time to examine what has occurred.
11.4.1
Viewing the MBeans
The easiest way to see if the MBeans are registered in the agent is to connect to the
when you connect to the agent using the URL http://localhost:9092. If you don't
see the correct MBeans, go back and verify all the MBean creation code. Also
chapter 2, where it is described in detail.)
Notice that MBeans now exist for the fax card, two phone cards, and the rout-
ing table. Also present are the relation service MBean and the
CtlRelation
MBean (under the object name “type=RelationMBean”). Click on your relation
MBean and view its available methods.
11.4.2
Viewing exposed methods
After clicking on the correct link, you should see the screens shown in figures 11.6
and 11.7.