Java Reference
In-Depth Information
object with its default constructor. Both classes contain the same default values
for host, port, and lookup name. The default values are the following:
■
Host—
Defaults to the local host value
■
Po r t —
Default value is contained in the static variable
ServiceName.RMI_
CONNECTOR_PORT
■
Lookup name—
Defaults to the value of
ServiceName.RMI_CONNECTOR_SERVER
After creating the
RmiConnectorClient
object, you invoke its
connect()
method.
This method tells the client object to make a connection with the server-side
component of the
RMI
connector. After successfully connecting to the agent, you
can return the client reference—ready for use.
9.2.4
Additional uses for the RMI connector
In addition to providing
RMI
connectivity to a
JMX
agent for invoking methods
on a remote MBean server, the
RMI
connector offers some other useful features.
The remaining features of the
RMI
connector are as follows:
■
Remote notifications—
The
RMI
connector will transmit notifications emitted
from the remote server to the remote client.
■
Connector heartbeat—
Connector clients can emit a heartbeat to monitor the
connection to the connector server. Doing so allows agents and client to
retry or clean up bad connections.
■
Client context checking—
This feature allows the server to verify that a client
has the correct context before invoking requested operations.
Recall that the
RMI
connector is contributed unsupported to the Sun
JMX
RI
.
The
RMI
connector is part of Sun's commercial product, the
JDMK
. With that in
mind, the following sections briefly describe the three previously listed features
in more detail.
Retrieving notifications
The
RMI
connector provides two ways to receive notifications from a remote
MBean server. When an
RMI
connector client connects to an
RMI
connector
server, it can specify a notification receiving mode via the client's
setMode()
method. The
setMode()
method takes a single parameter: either
ClientNotifi-
cationHandler.PUSH_MODE
or
ClientNotificationHandler.PULL_MODE
. The first
value indicates that notifications from the remote
JMX
agent will be pushed to
the
RMI
connector client, and the second value indicates that the
RMI
connector
client will pull notifications from the remote agent.