JU.5. Supporting Interfaces and Classes

The JoinManager class depends on the interfaces DiscoveryManagement and ServiceIDListener discussed below.

JoinManager also references the concrete classes LookupDiscoveryManager and LeaseRenewalManager, each described in a separate specification.

JU.5.1. The DiscoveryManagement Interface

Although it is not necessary for the JoinManager itself to execute the discovery process, it does need to be notified when one of the lookup services it wishes to join is discovered or discarded. Thus, at a minimum, the JoinManager requires access to the discovery events sent to the listeners registered with the discovery process’ event mechanism. The instance of DiscoveryManagement that is passed as an argument to the constructor of the JoinManager provides a mechanism for acquiring access to those events. For a complete description of the semantics of the methods of this interface, refer to the Jini Discovery Utilities Specification.

One noteworthy item about the semantics of the JoinManager is the effect that invocations of the discard method of DiscoveryManagement will have on any discovery listeners created by the JoinManager. The DiscoveryManagement interface specifies that the discard method will remove a particular lookup service from the managed set of lookup services that have already been discovered, allowing that lookup service to be rediscovered. Invoking this method will result in the flushing of the lookup service from the appropriate cache, ultimately causing a discard notification to be sent to all DiscoveryListener objects registered with the event mechanism of the discovery process, including all listeners registered by the JoinManager.

The receipt of an event notification indicating that a lookup service has been discarded ultimately results in the removal (but not cancellation) of the registration lease granted by the discarded lookup service, and that is managed by the LeaseRenewalManager on behalf of the JoinManager. After removal occurs, the lease will eventually expire.

JU.5.2. The ServiceIDListener Interface

The ServiceIDListener interface defines the methods used by a service to register a request for notification from the JoinManager upon the assignment of a serviceID by a lookup service. It is the responsibility of the service to create and pass into the JoinManager an object that implements this interface. That implementation must provide the definition of the actions to take upon receipt of the notification. Typically, the action taken will be to persist the assigned serviceID reference.

package net.jini.lookup; 

public interface ServiceIDListener extends EventListener {
    public void serviceIDNotify(ServiceID serviceID); 
} 

The intent of this interface is to allow the entity to receive the ServiceID instance assigned to it by the lookup service. It is not part of the semantics of the call that the return from the ServiceIDNotify method can be delayed while the recipient of the call processes the information delivered by the method. Thus, it is highly recommended that implementations of this interface avoid time consuming operations, and return from the method as quickly as possible. For example, one strategy might be to simply notify a separate thread, operating asynchronously, which is designed to place the ServiceID instance in persistent storage.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.189.178.237