Java Reference
In-Depth Information
5.5 Dynamic MBeans in action
Now that you have read about writing and working with the management inter-
face of a Dynamic MBean, it's time to look at a few examples. The following exam-
ples involve the Jini network technology. Our discussion will mostly center around
working with JMX , not the Jini technologies. However, if you need more infor-
mation about Jini, go to http://www.javasoft.com.
5.5.1
Managing a Jini service
Jini network technology is another emerging Java technology. Programs that
want to use a Jini service use a discovery technique that hides the network trans-
portation layer and the location of the service.
Jini services make themselves available for discovery by registering with
lookup registries all across a network. Services use a broadcasting system to find
lookup registries and register on them. In turn, client programs find these ser-
vice registries to get references to Jini services. Once a client has a reference to
that service, it interacts with the service using Java Remote Method Invocation
( RMI ). For example, a Java program can search and find a Jini service that pro-
vides the ability to print documents.
Client programs wishing to use Jini services need a way to know which service
will meet their needs. Jini services can advertise , or describe, their function and
capabilities. When registering on a service lookup registry, a Jini service con-
structs a service template object that contains information about the service. Spe-
cifically, the template contains the interface type of the service and a set of Entry
objects that describe attributes of the service. Entry objects could be something
like a name, address, or type. (To read more about this technology, go to http://
www.javasoft.com/jini.)
When the Jini service is created, it registers an MBean with a JMX agent. The
MBean is now available for a management application to configure that Jini ser-
vice without having to restart or bring down the service.
To start this example, imagine you have created a Jini service to perform a
business function like calculating payroll. The service would implement a remote
interface Payroll , for example, that would allow you to invoke methods upon it
after discovery. In addition to the Payroll interface, you will have the service
implement another remote interface, ManagedJINIService . This interface will
contain any methods you want to expose with the MBean created by the Jini ser-
vice. Figure 5.2 illustrates this relationship.
 
 
Search WWH ::




Custom Search