|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectnet.jini.discovery.LookupLocatorDiscovery
This class encapsulates the functionality required of an entity that wishes to employ the unicast discovery protocol to discover a lookup service. This utility provides an implementation that makes the process of finding specific lookup services much simpler for both services and clients.
Because this class participates in only the unicast discovery protocol,
and because the unicast discovery protocol imposes no restriction on the
physical location of the entity relative to a lookup service, this utility
can be used to discover lookup services running on hosts that are located
far from, or near to, the host on which the entity is running. This lack
of a restriction on location brings with it a requirement that the
discovering entity supply this class with specific information about the
desired lookup services; namely, the location of the device(s) hosting
each lookup service. This information is supplied through an instance
of the LookupLocator class.
LookupLocatorConfiguring LookupLocatorDiscovery
This implementation of
LookupLocatorDiscovery supports the
following configuration entries; where each configuration entry name
is associated with the component name
net.jini.discovery.LookupLocatorDiscovery. Note that the
configuration entries specified here are specific to this implementation
of | • |
initialUnicastDelayRange
| |
|---|---|---|
|   | Type: | long
|
|   | Default: | 0 milliseconds
|
|   | Description: | With respect to when this utility is started, this entry controls
how long to wait before attempting unicast discovery.
If the value is positive, initial unicast discovery requests
will be delayed by a random value between 0 and
initialUnicastDelayRange milliseconds. Once the wait
period is up, the LookupLocators specified at construction
time are used for initiating unicast discovery requests, unless the
managed LookupLocators have been changed in the interim;
in which case, no delayed unicast discovery requests are performed.
Note that this entry only has effect when this utility is initialized.
It does not delay discovery requests that are initiated if the managed
LookupLocators are subsequently changed.
|
| • |
registrarPreparer
| |
|---|---|---|
|   | Type: | ProxyPreparer
|
|   | Default: | new
|
|   | Description: | Preparer for the proxies to the lookup services that are
discovered and used by this utility.
This preparer should perform all operations required to use a newly received proxy to a lookup service, which may including verifying trust in the proxy, granting permissions, and setting constraints.
Currently, none of the methods on the
|
| • |
taskManager
| |
|---|---|---|
|   | Type: | TaskManager
|
|   | Default: | new
|
|   | Description: | The object that pools and manages the various threads executed by this utility. The default manager creates a maximum of 15 threads, waits 15 seconds before removing idle threads, and uses a load factor of 1.0 when determining whether to create a new thread. This object should not be shared with other components in the application that employs this utility. |
| • |
wakeupManager
| |
|---|---|---|
|   | Type: | WakeupManager
|
|   | Default: | new
|
|   | Description: | Object that pools and manages the various tasks that are
initially executed by the object corresponding to the
taskManager entry
of this component, but which fail during that initial execution.
This object schedules the re-execution of such a failed task -
in the taskManager
object - at various times in the future, (employing a
"backoff strategy"). The re-execution of the failed task will
continue to be scheduled by this object until the task finally
succeeds. This object should not be shared with other components
in the application that employs this utility.
|
Logging
This implementation of
LookupLocatorDiscovery uses the
Logger named net.jini.discovery.LookupLocatorDiscovery
to log information at the following logging levels:
| Level | Description |
|---|---|
INFO |
when any exception occurs in a task or thread, while attempting unicast discovery of a given locator |
INFO |
when any exception occurs while attempting to prepare a proxy |
HANDLED |
when an exception is handled during unicast discovery. |
FINEST |
whenever any thread or task is started |
FINEST |
whenever any thread (except the Notifier thread) or task
completes successfully
|
FINEST |
whenever a discovered or discarded event is sent |
FINEST |
whenever a proxy is prepared |
FINEST |
when an IOException occurs upon attempting to close the
socket after a unicast discovery attempt has either completed
successfully or failed
|
This implementation of LookupLocatorDiscovery determines
the constraints (if any) to apply to unicast discovery for a given
LookupLocator instance
by calling the
getConstraints method of that instance, if it implements the
RemoteMethodControl
interface. If the LookupLocator instance does not implement
RemoteMethodControl,
then no constraints are applied to unicast discovery for that instance.
For more information on constraining unicast discovery, refer to the
documentation for the ConstrainableLookupLocator class.
| Constructor Summary | |
LookupLocatorDiscovery(LookupLocator[] locators)
Creates an instance of this class ( LookupLocatorDiscovery),
with an initial array of LookupLocators to be managed.
|
|
LookupLocatorDiscovery(LookupLocator[] locators,
Configuration config)
Constructs a new lookup locator discovery object, set to discover the given set of locators, and having the given Configuration.
|
|
| Method Summary | |
void |
addDiscoveryListener(DiscoveryListener l)
Add a DiscoveryListener to the listener set. |
void |
addLocators(LookupLocator[] locators)
Adds a set of locators to the managed set of locators. |
void |
discard(ServiceRegistrar proxy)
Removes an instance of ServiceRegistrar from the
managed set of lookup services, making the corresponding lookup
service eligible for re-discovery. |
LookupLocator[] |
getDiscoveredLocators()
Returns the set of LookupLocator objects representing the
desired lookup services that are currently discovered. |
LookupLocator[] |
getLocators()
Returns an array consisting of the elements of the managed set of locators; that is, instances of LookupLocator in
which each instance corresponds to a specific lookup service to
discover. |
ServiceRegistrar[] |
getRegistrars()
Returns an array of instances of ServiceRegistrar, each
corresponding to a proxy to one of the currently discovered lookup
services. |
LookupLocator[] |
getUndiscoveredLocators()
Returns the set of LookupLocator objects representing the
desired lookup services that have not yet been discovered. |
void |
removeDiscoveryListener(DiscoveryListener l)
Remove a DiscoveryListener from the listener set. |
void |
removeLocators(LookupLocator[] locators)
Deletes a set of locators from the managed set of locators, and discards any already-discovered lookup service that corresponds to a deleted locator. |
void |
setLocators(LookupLocator[] locators)
Replaces all of the locators in the managed set with locators from a new set, and discards any already-discovered lookup service that corresponds to a locator that is removed from the managed set as a result of an invocation of this method. |
void |
terminate()
Terminates all threads, ending all locator discovery processing being performed by the current instance of this class. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public LookupLocatorDiscovery(LookupLocator[] locators)
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.
locators - the locators to discover
NullPointerException - input array contains at least
one null element
public LookupLocatorDiscovery(LookupLocator[] locators,
Configuration config)
throws ConfigurationException
Configuration.
For each managed LookupLocator, unicast discovery is
performed to obtain a ServiceRegistrar proxy for that
lookup service.
locators - the locators to discoverconfig - an instance of Configuration, used to
obtain the objects needed to configure the current
instance of this class
ConfigurationException - indicates an exception
occurred while retrieving an item from the given
Configuration
NullPointerException - input array contains at least
one null element or null is input
for the configuration| Method Detail |
public void addDiscoveryListener(DiscoveryListener l)
addDiscoveryListener in interface DiscoveryManagementl - the new DiscoveryListener to add
NullPointerException - this exception occurs when
null is input to the listener parameter
l.
IllegalStateException - this exception occurs when
this method is called after the terminate
method has been called.removeDiscoveryListener(net.jini.discovery.DiscoveryListener)public void removeDiscoveryListener(DiscoveryListener l)
removeDiscoveryListener in interface DiscoveryManagementl - the existing DiscoveryListener to remove
IllegalStateException - this exception occurs when
this method is called after the terminate
method has been called.addDiscoveryListener(net.jini.discovery.DiscoveryListener)public ServiceRegistrar[] getRegistrars()
ServiceRegistrar, each
corresponding to a proxy to one of the currently discovered lookup
services. For each invocation of this method, a new array is returned.
getRegistrars in interface DiscoveryManagementServiceRegistrar, each
corresponding to a proxy to one of the currently discovered
lookup services
IllegalStateException - this exception occurs when
this method is called after the terminate
method has been called.ServiceRegistrar,
DiscoveryManagement.removeDiscoveryListener(net.jini.discovery.DiscoveryListener)public void discard(ServiceRegistrar proxy)
ServiceRegistrar from the
managed set of lookup services, making the corresponding lookup
service eligible for re-discovery. This method takes no action if
the parameter input to this method is null, or if it
does not match (using equals) any of the elements in
the managed set.
discard in interface DiscoveryManagementproxy - the instance of ServiceRegistrar to discard
from the managed set of lookup services
IllegalStateException - this exception occurs when
this method is called after the terminate
method has been called.ServiceRegistrar,
DiscoveryManagement.discard(net.jini.core.lookup.ServiceRegistrar)public void terminate()
After this method has been invoked, no new lookup services will be discovered, and the effect of any new operations performed on the current instance of this class are undefined.
terminate in interface DiscoveryManagementDiscoveryManagement.terminate()public LookupLocator[] getLocators()
LookupLocator in
which each instance corresponds to a specific lookup service to
discover. The returned set will include both the set of
LookupLocators corresponding to lookup services
that have already been discovered as well as the set of those
that have not yet been discovered. If the managed set of locators
is empty, this method will return the empty array. This method
returns a new array upon each invocation.
getLocators in interface DiscoveryLocatorManagementLookupLocator array consisting of the elements
of the managed set of locators
IllegalStateException - this exception occurs when
this method is called after the terminate
method has been called.DiscoveryLocatorManagement.getLocators(),
setLocators(net.jini.core.discovery.LookupLocator[])public void addLocators(LookupLocator[] locators)
LookupLocator.equals
method) elements already in the managed set will be ignored. If the
empty array is input, the managed set of locators will not change.
addLocators in interface DiscoveryLocatorManagementlocators - LookupLocator array consisting of the
locators to add to the managed set.
NullPointerException - this exception occurs when
either null is input to the locators
parameter, or one or more of the elements of the
locators parameter is null.
IllegalStateException - this exception occurs when
this method is called after the terminate
method has been called.DiscoveryLocatorManagement.addLocators(net.jini.core.discovery.LookupLocator[]),
removeLocators(net.jini.core.discovery.LookupLocator[])public void setLocators(LookupLocator[] locators)
If the empty array is input, locator discovery will cease until this
method is invoked with an input parameter that is non-null
and non-empty.
setLocators in interface DiscoveryLocatorManagementlocators - LookupLocator array consisting of the
locators that will replace the current locators in the
managed set.
NullPointerException - this exception occurs when
either null is input to the locators
parameter, or one or more of the elements of the
locators parameter is null.
IllegalStateException - this exception occurs when
this method is called after the terminate
method has been called.DiscoveryLocatorManagement.setLocators(net.jini.core.discovery.LookupLocator[]),
getLocators()public void removeLocators(LookupLocator[] locators)
If the empty array is input, this method takes no action.
removeLocators in interface DiscoveryLocatorManagementlocators - LookupLocator array consisting of the
locators that will be removed from the managed set.
NullPointerException - this exception occurs when
either null is input to the locators
parameter, or one or more of the elements of the
locators parameter is null.
IllegalStateException - this exception occurs when
this method is called after the terminate
method has been called.DiscoveryLocatorManagement.removeLocators(net.jini.core.discovery.LookupLocator[]),
addLocators(net.jini.core.discovery.LookupLocator[])public LookupLocator[] getDiscoveredLocators()
LookupLocator objects representing the
desired lookup services that are currently discovered. If no lookup
services are currently discovered, this method returns the empty array.
This method returns a new array upon each invocation.
LookupLocator array consisting of the elements
from the managed set of locators that correspond to lookup
services that have already been discovered.
IllegalStateException - this exception occurs when
this method is called after the terminate
method has been called.public LookupLocator[] getUndiscoveredLocators()
LookupLocator objects representing the
desired lookup services that have not yet been discovered. If all
of the desired lookup services are currently discovered, this method
returns the empty array. This method returns a new array upon each
invocation.
LookupLocator array consisting of the elements
from the managed set of locators that correspond to lookup
services that have not yet been discovered.
IllegalStateException - this exception occurs when
this method is called after the terminate
method has been called.
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||