![]() |
|||
![]() |
![]() ![]() |
![]() |
![]() ![]() |
![]() |
![]() ![]() |
![]() |
| ||||||
In Example 9-5, we see that the connector servers are created in a similar way to standard connector servers defined by the JMX Remote API. The only difference is that the connector protocols used to create the JMX service URLs are jdmk-rmi and jmdk-http. For simplicity, this example does not create an HTTPS connector. Note - As you can see above, the wrapped connector server is registered in the MBean server before it is started. This order of events must always be respected, otherwise the wrapped connector will not work. Example 9-6 Wrapping Legacy Connector Clients
As for the creation of the connector servers, in Example 9-6, the legacy connector clients are created by passing the jdmk-http and jdmk-rmi property strings to the JMX service URLs. The rest of the Client example is identical to a standard JMX Remote API connector client.
|
$ javac -classpath classpath *.java |
Start the Server
$ java -classpath .:classpath Server & |
You will see confirmation of the creation of the wrapped connector servers, and will be prompted to start the Client.
When prompted, start the Client
$ java -classpath .:classpath Client |
You will see the wrapped HTTP connector client connect to the HTTP server, and perform various MBean operations via the connection. Once the MBean operations have completed, the Client closes the HTTP connection, before opening a connection to the legacy RMI connector server, and performing further MBean operations.
The wrapped legacy connectors do not provide the full functionality of either their JMX Remote API or their Java DMK 5.0 counterparts. The limitations of the wrapped legacy connectors are listed below.
Not all of the methods supported by standard JMXConnector and JMXConnectorServer are supported by the wrapped legacy connectors.
The following are the only methods supported by the wrapped legacy connector clients.
addNotificationListener(ObjectName name, ObjectName listener, NotificationFilter filter, Object handback)
removeNotificationListener(ObjectName name, ObjectName listener)
removeNotificationListener(ObjectName name, ObjectName listener, NotificationFilter filter, Object handback)
removeNotificationListener(ObjectName name, NotificationListener listener, NotificationFilter filter, Object handback)
The wrapped legacy connector servers only support the getConnectionIds() method.
A legacy connector can only use the class loader that was used to created that connector.
Legacy servers do not send out events relating to client connections or failures, but only about state changes: offline, starting, online.
A client can connect to a legacy connector server created by the JMX Remote API factory only after the server has been registered in an MBean server.
A legacy connector client has no way of showing its local port number. Calling Client.getConnectionId() will return:
protocol://host:server_port count |
Where the count is an integer ID that is unique within a Java virtual machine on the client side. For example:
jdmk-http://host_name:6666 1 |
A legacy connector server must be registered as an MBean in the MBean server which is exposed through that connector server, before the server can be started.
![]() ![]() |