Java Reference
In-Depth Information
9.3.3
Outstanding issues
This connector example leaves out some important features. For instance, there
are important details to consider when implementing the connector's notifica-
tion delivery mechanism. You should also make changes so that multiple agents
running this type of connector are distinguishable from each other.
Handling notifications
In a normal notification scenario, an agent directly invokes an object that has
registered as a notification listener in order to deliver notifications to it. How-
ever, in the distributed environment, the notification listener may be in a remote
location, and direct invocation may not be possible.
Therefore, the implementation of the addNotificationListener() methods
of the JINIConnectorClient must be different than the usual server.method()
invocation seen in the two methods you implemented. The add-listener methods
must take into account the distributed nature of the connector. The best way to
solve this problem is to have the JINIConnectorClient instance store the listener
reference locally and add itself as the notification listener instead. The client can
alternatively be a remote object; in that case the remote MBean can deliver noti-
fications to the client, which can distribute them as needed to local listeners.
Jini connector attributes
Consider the environment that has two active JMX agents, both of which are
using a Jini connector to allow remote clients to discover them. These two agents
need the ability to ensure that their respective Jini services (created by the Jini
connector) are uniquely identifiable. The JINIServer MBean allows the agent to
set a single attribute for the service. The JINIServer MBean should always con-
struct the Jini service using these attributes to be as unique as possible. In addi-
tion, the JINIConnectorClient needs code to allow a user to enter possible
attribute values when the client begins to search for the Jini service. This code
will let client users refine their search for a remote JMX agent.
9.3.4
Testing the Jini connector
We have covered all the components of the Jini connector; it is time to use it in
an example. To test the connector, you need to modify the JMXBookAgent class.
For your agent, you will add the startJINIConnector() method. For the client,
you will use the JINIConnectorClient class's main method. Typically, a client will
construct an instance of the JINIConnectorClient class to use. The following sec-
tion examines the startJINIConnector() method.
Search WWH ::




Custom Search