com.sun.jini.discovery
Class LookupLocatorDiscovery

java.lang.Object
  |
  +--com.sun.jini.discovery.LookupLocatorDiscovery

public final class LookupLocatorDiscovery
extends java.lang.Object

This class allows one to find out about specific instances of the Jini lookup service, nearby or far away, using LookupLocators. It provides a simple unified front end to the unicast discovery protocol. The operations are appropriately synchronized for concurrent operation.


Constructor Summary
LookupLocatorDiscovery(LookupLocator[] locators)
          Create a LookupLocatorDiscovery, with an initial array of LookupLocators to be managed.
 
Method Summary
 void addDiscoveryListener(DiscoveryListener l)
          Add a DiscoveryListener to the listener set.
 void addLocators(LookupLocator[] locators)
          Adds LookupLocators to managed set.
 void discard(ServiceRegistrar proxy)
          Discard a LookupLocator from the discovered LookupLocator set.
 LookupLocator[] getDiscoveredLocators()
          Returns an array of the managed LookupLocators for which corresponding lookup services have been discovered.
 LookupLocator[] getLocators()
          Returns an array of the LookupLocators that are being managed.
 LookupLocator[] getUndiscoveredLocators()
          Returns an array of the managed LookupLocators for which corresponding lookup services have not yet been discovered.
 void removeDiscoveryListener(DiscoveryListener l)
          Remove a DiscoveryListener from the listener set.
 void removeLocators(LookupLocator[] locators)
          Removes LookupLocators from the managed set, and discards any associated discovered lookup services.
 void setLocators(LookupLocator[] locators)
          Replaces the currently managed LookupLocators with a new set.
 void terminate()
          Terminates all daemon threads.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LookupLocatorDiscovery

public LookupLocatorDiscovery(LookupLocator[] locators)
Create a LookupLocatorDiscovery, with an initial array of LookupLocators to be managed. For each managed LookupLocator, unicast discovery is performed to obtain a ServiceRegistrar proxy for that lookup service.
Parameters:
locators - the locators to discover
Method Detail

addDiscoveryListener

public void addDiscoveryListener(DiscoveryListener l)
Add a DiscoveryListener to the listener set. The listener's discovered method gets called right way with an array of ServiceRegistrars that have already been discoved, and will be called in the future whenever additional lookup services are discovered.
Parameters:
l - the new DiscoveryListener to add

removeDiscoveryListener

public void removeDiscoveryListener(DiscoveryListener l)
Remove a DiscoveryListener from the listener set. It does nothing if the DiscoveryListener does not exist in the the listener set.
Parameters:
l - the existing DiscoveryListener to remove

discard

public void discard(ServiceRegistrar proxy)
Discard a LookupLocator from the discovered LookupLocator set. It does nothing if a LookupLocator cannot be found in the LookupLocator set to match the proxy. If a match is found, the LookupLocator will be tried for re-discovery.
Parameters:
proxy - the ServiceRegistrar of the LookupLocator to discard

getLocators

public LookupLocator[] getLocators()
Returns an array of the LookupLocators that are being managed. The array includes all LookupLocators, even those that have not yet been successfully discovered. A new array is returned each time.

addLocators

public void addLocators(LookupLocator[] locators)
Adds LookupLocators to managed set. Duplicates of existing managed LookupLocators are ignored.
Parameters:
locators - the LookupLocators to add

removeLocators

public void removeLocators(LookupLocator[] locators)
Removes LookupLocators from the managed set, and discards any associated discovered lookup services. Discard notifications are sent for any corresponding lookup services that are in the discovered set.
Parameters:
locators - the LookupLocators to remove

setLocators

public void setLocators(LookupLocator[] locators)
Replaces the currently managed LookupLocators with a new set. Discard notifications are sent for any lookup services that are in the current discovered set but do not have a corresponding LookupLocator in the new managed set.
Parameters:
locators - the new LookupLocators

terminate

public void terminate()
Terminates all daemon threads. No further operations on the object should be performed.

getDiscoveredLocators

public LookupLocator[] getDiscoveredLocators()
Returns an array of the managed LookupLocators for which corresponding lookup services have been discovered. A new array is returned each time.

getUndiscoveredLocators

public LookupLocator[] getUndiscoveredLocators()
Returns an array of the managed LookupLocators for which corresponding lookup services have not yet been discovered. A new array is returned each time.


Copyright © 1999 Sun Microsystems, Inc. All rights reserved