9.3 Examples of Connector Servers
The connector server examples demonstrate the following:
-
The server:
-
Creates an MBean server
-
Creates an RMI or a JMXMP connector server
-
The remote client:
-
Creates an RMI or a JMXMP connector
-
Creates a simple standard MBean in the MBean server, via the
RMI connection
-
Creates a generic notification listener.
-
Basic operations are performed on the MBean registered in
the MBean server, via the RMI connection
9.3.1 RMI Connector Server Example
The RMI connector server example is found in the examplesDir/current/Connectors/rmi directory.
To Run the RMI Connector Server Example
-
Compile the Java classes.
$ javac -classpath classpath *.java
|
-
Start an RMI registry on port 9999 of the local host.
$ export CLASSPATH=.:classpath ; rmiregistry 9999 &
|
-
Start the RMI connector server:
$ java -classpath .:classpath Server &
|
You will see confirmation of the creation of the MBean server and the
RMI connector server.
-
Start the RMI connector client:
$ java -classpath .:classpath Client
|
You will see confirmation of the creation of the RMI connector client
and of the connection with the connector server. You will also be informed
of the domain name, and the creation and registration of SimpleStandard MBean. The client will then perform operations on SimpleStandard MBean, before unregistering it.
9.3.2 JMXMP Connector Server Example
The JMXMP connector server example is found in the examplesDir/current/Connectors/jmxmp directory.
To Run the JMXMP Connector Server Example
-
Compile the Java classes.
$ javac -classpath classpath *.java
|
-
Start the JMXMP connector server:
$ java -classpath .:classpath Server &
|
You will see confirmation of the creation of the MBean server and the
JMXMP connector server.
-
Start the JMXMP connector client:
$ java -classpath .:classpath Client
|
You will see confirmation of the creation of the RMI connector client
and of the connection with the connector server. You will also be informed
of the domain name, and the creation and registration of SimpleStandard MBean. The client will then perform operations on SimpleStandard MBean, before unregistering it.