Java Reference
In-Depth Information
were valid, would invoke the method on the MBean server. To provide your own
implementation for the check methods, you would provide a subclass to the
MBeanServerChecker
class.
9.3 Connecting to agents using Jini
The
RMI
connector we just discussed should give you a good idea what can be
accomplished by making your
JMX
agents remotely accessible. As you discov-
ered, the
RMI
connector not only gives you the ability to invoke MBean server
methods, but also lets you receive notifications.
However, you might have noticed one drawback to using the
RMI
connec-
tor: you must know the address of the
RMI
connector server. That is, you have
to be able to tell your
RmiConnectorClient
object where to look up the remote
server object.
To get around this issue, you can build a Jini connector. By using Jini, you can
distribute a
JMX
agent just like the
RMI
connector does, without requiring clients
to know the exact location of the agent. Jini enables developers to write services
that can describe themselves and can be discovered by clients.
For instance, clients wishing to interact with a
JMX
agent can construct a Jini
connector client, enter a few search parameters, and locate the nearest matching
agent, as illustrated in figure 9.3.
Your Jini connector will advertise itself by using the value of the default
domain name of the MBean server in which it is registered. The Jini connector
client will do a search for agents by using the domain name as a search parameter.
Later, you can expand the search capabilities as needed. As the chapter continues,
Figure 9.3 The Jini connector makes the JMX agent available to a greater client
audience by allowing itself to be discovered.