Java Reference
In-Depth Information
{
private JINIServer server = null;
public JINIConnectorImpl( JINIServer server )
throws RemoteException
{
this.server = server;
C
Store reference
to Jini service
}
public Integer getMBeanCount() throws JINIConnectorException
{
try
{
return server.getMBeanCount();
}
catch( Exception e )
{
throw new JINIConnectorException( "getMBeanCount", e );
}
}
public ObjectInstance createMBean(String className,
ObjectName name) throws
JINIConnectorException
{
try
{
return server.createMBean( className, name );
}
catch( Exception e )
{
throw new JINIConnectorException( "createMBean", e );
}
}
}
B
In order to be a Jini service, this class must be a remote class. That is, it must be
available in a Java RMI environment. Toward this end, it extends the UnicastRem-
oteObject class, which provides the service with the capabilities of a remote object.
In addition, it implements its remote interface, JINIConnector , which declares
the methods that will be available to clients.
The key feature of this class is that it contains a reference to the JINIServer
MBean from the JMX agent. This reference allows the service to make callbacks
to the MBean to perform the necessary invocations for a service client.
As you can see, the source is short. However, remember that you imple-
mented only two corresponding methods to the MBean server—to finish this
C
Search WWH ::




Custom Search