Java Reference
In-Depth Information
C
The JINIServer class implements the following three interfaces:
JINIServerMBean —This MBean interface declares the exposed attributes
and operations for this MBean.
MBeanRegistration —Recall from chapter 4 that this interface allows the
MBean to acquire a reference to the MBean server. For more information,
look back at that chapter.
ServiceIDListener —This is a Jini interface that allows the Jini lookup ser-
vice to perform a callback and inform the listener (the interface imple-
menter) of the unique service id generated for a particular Jini service. It
declares only one method: public void serviceIDNotify() .
With a reference to the MBean server, the MBean can propagate correspond-
ing invocations from the Jini service to the MBean server. (More about this in
a moment.)
The JINIServer class uses a Jini utility class, JoinManager , which handles the lookup,
registration, and management of lookup services for a particular Jini service.
You can see how it is created in the createService() method. The MBean keeps
a reference to this class in order to manage the attributes of the JINIConnec-
torImpl service.
The createService() method is where all the action takes place in this MBean.
This method is invoked when the JMX agent calls the enableConnections()
method of the MBean. It is responsible for creating the Jini service class ( JINI-
ConnectorImpl ) and registering it with available Jini lookup services. We will
examine the JINIConnectorImpl class in the next code listing, but as you can
see, all you have to do is use the constructor that accepts a reference to this
MBean. The JINIConnectorImpl class will use that reference to make callbacks
to the MBean.
Once the service is created, it must be made available to possible clients. As
mentioned earlier, the JINIServer MBean uses a Jini utility class called JoinMan-
ager to handle all the logistics surrounding registration and management of a
service on a lookup service. (For more information about the JoinManager class,
refer to the javadocs bundled in the Jini download.)
All the methods after this point correspond to methods in the MBean server.
These are the callback methods the Jini service invokes in order to perform an
operation on the MBeanServer instance residing in the JMX agent. For the sake of
space, only two methods are currently implemented: getMBeanCount() and cre-
ateMBean() . You will use the latter method in your tests later.
D
E
F
Search WWH ::




Custom Search