public class LookupLocatorDiscovery extends Object implements DiscoveryManagement, DiscoveryLocatorManagement
LookupLocator
class.Constructor and Description |
---|
LookupLocatorDiscovery(LookupLocator[] locators)
Creates an instance of this class (
LookupLocatorDiscovery ),
with an initial array of LookupLocator s 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 . |
Modifier and Type | Method and Description |
---|---|
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.
|
public LookupLocatorDiscovery(LookupLocator[] locators)
LookupLocatorDiscovery
),
with an initial array of LookupLocator
s to be managed. For
each managed LookupLocator
, unicast discovery is performed
to obtain a ServiceRegistrar
proxy for that lookup service.locators
- the locators to discoverNullPointerException
- input array contains at least one
null
elementpublic 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 classConfigurationException
- 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
configurationpublic void addDiscoveryListener(DiscoveryListener l)
addDiscoveryListener
in interface DiscoveryManagement
l
- the new DiscoveryListener to addNullPointerException
- 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 DiscoveryManagement
l
- the existing DiscoveryListener to removeIllegalStateException
- 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 DiscoveryManagement
ServiceRegistrar
, each
corresponding to a proxy to one of the currently discovered
lookup servicesIllegalStateException
- 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 DiscoveryManagement
proxy
- the instance of ServiceRegistrar
to discard
from the managed set of lookup servicesIllegalStateException
- 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()
terminate
in interface DiscoveryManagement
DiscoveryManagement.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 LookupLocator
s
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 DiscoveryLocatorManagement
LookupLocator
array consisting of the elements of
the managed set of locatorsIllegalStateException
- 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 DiscoveryLocatorManagement
locators
- 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)
null
and non-empty.setLocators
in interface DiscoveryLocatorManagement
locators
- 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)
removeLocators
in interface DiscoveryLocatorManagement
locators
- 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.Copyright © GigaSpaces.