|
GigaSpaces XAP 9.7.2 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.jini.discovery.LookupDiscovery
public class LookupDiscovery
This class is a helper utility class that encapsulates the functionality required of an entity that wishes to employ multicast discovery to find lookup services located within the entity's "multicast radius" (roughly, the number of hops beyond which neither the multicast requests from the entity, nor the multicast announcements from the lookup service, will propagate). This class helps make the process of acquiring references to lookup services - based on no information other than lookup service group membership - much simpler for both services and clients.
ServiceRegistrar
,
DiscoveryChangeListener
,
DiscoveryManagement
,
DiscoveryGroupManagement
,
DiscoveryListener
,
DiscoveryEvent
,
DiscoveryPermission
Field Summary | |
---|---|
static String[] |
ALL_GROUPS
Convenience constant used to request that attempts be made to discover all lookup services that are within range, and which belong to any group. |
static String[] |
NO_GROUPS
Convenience constant used to request that discovery by group membership be halted (or not started, if the group discovery mechanism is simply being instantiated). |
Constructor Summary | |
---|---|
LookupDiscovery(String[] groups)
Construct a new lookup discovery object, set to discover the given set of groups. |
|
LookupDiscovery(String[] groups,
Configuration config)
Constructs a new lookup discovery object, set to discover the given set of groups, and having the given Configuration . |
Method Summary | |
---|---|
void |
addDiscoveryListener(DiscoveryListener l)
Register a listener as interested in receiving DiscoveryEvent notifications. |
void |
addGroups(String[] newGroups)
Add a set of groups to the set to be discovered. |
void |
discard(ServiceRegistrar reg)
Discard a registrar from the set of registrars already discovered. |
String[] |
getGroups()
Return the set of group names this LookupDiscovery instance is trying to discover. |
ServiceRegistrar[] |
getRegistrars()
Returns an array of instances of ServiceRegistrar , each
corresponding to a proxy to one of the currently discovered lookup
services. |
void |
removeDiscoveryListener(DiscoveryListener l)
Indicate that a listener is no longer interested in receiving DiscoveryEvent notifications. |
void |
removeGroups(String[] oldGroups)
Remove a set of groups from the set to be discovered. |
void |
setGroups(String[] newGroups)
Change the set of groups to be discovered to correspond to the given set. |
void |
terminate()
Terminate the discovery process. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String[] ALL_GROUPS
DiscoveryGroupManagement
for compatibility with
earlier releases.
public static final String[] NO_GROUPS
DiscoveryGroupManagement
for
compatibility with earlier releases.
Constructor Detail |
---|
public LookupDiscovery(String[] groups) throws IOException
groups
- the set of group names to discover (null for no
set, empty for no discovery)
NullPointerException
- input array contains at least
one null element
IOException
- an exception occurred in starting discoveryNO_GROUPS
,
ALL_GROUPS
,
setGroups(java.lang.String[])
,
DiscoveryPermission
public LookupDiscovery(String[] groups, Configuration config) throws IOException, ConfigurationException
Configuration
.
The set of groups to discover is represented as an array of
strings. This array may be empty, which is taken as the empty
set, and discovery is not performed. The reference passed in
may be null
, which is taken as no set, and in which
case discovery of all reachable lookup services is performed.
Otherwise, the array contains the names of groups to discover.
The caller must have DiscoveryPermission
for each
group (or for all groups, if the array is null
).
groups
- the set of group names to discover (null for no
set, empty for no discovery)config
- an instance of Configuration
, used to
obtain the objects needed to configure the current
instance of this class
NullPointerException
- input array contains at least
one null
element or null
is input
for the configuration
IOException
- an exception occurred in starting discovery
ConfigurationException
- indicates an exception
occurred while retrieving an item from the given
Configuration
NO_GROUPS
,
ALL_GROUPS
,
setGroups(java.lang.String[])
,
DiscoveryPermission
,
Configuration
,
ConfigurationException
Method Detail |
---|
public void addDiscoveryListener(DiscoveryListener l)
addDiscoveryListener
in interface DiscoveryManagement
l
- the listener to register
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.DiscoveryEvent
,
removeDiscoveryListener(net.jini.discovery.DiscoveryListener)
public void removeDiscoveryListener(DiscoveryListener l)
removeDiscoveryListener
in interface DiscoveryManagement
l
- the listener to unregister
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 DiscoveryManagement
ServiceRegistrar
, 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 reg)
If the registrar has been discovered using this LookupDiscovery object, each listener registered with this object will have its discarded method called with the given registrar as parameter.
discard
in interface DiscoveryManagement
reg
- the registrar to discard
IllegalStateException
- this exception occurs when
this method is called after the terminate
method has been called.DiscoveryListener.discarded(net.jini.discovery.DiscoveryEvent)
public void terminate()
terminate
in interface DiscoveryManagement
public String[] getGroups()
getGroups
in interface DiscoveryGroupManagement
IllegalStateException
- this exception occurs when
this method is called after the terminate
method has been called.NO_GROUPS
,
ALL_GROUPS
,
setGroups(java.lang.String[])
public void addGroups(String[] newGroups) throws IOException
addGroups
in interface DiscoveryGroupManagement
newGroups
- the groups to add
IOException
- the multicast request protocol failed
to start
IllegalStateException
- this exception occurs when
this method is called after the terminate
method has been called.
UnsupportedOperationException
- there is no set of
groups to add toDiscoveryPermission
public void setGroups(String[] newGroups) throws IOException
setGroups
in interface DiscoveryGroupManagement
newGroups
- the new set of groups to discover (null for
all, empty array for no discovery)
IOException
- an exception occurred when starting
multicast discovery
IllegalStateException
- this exception occurs when
this method is called after the terminate
method has been called.LookupDiscovery(java.lang.String[], net.jini.config.Configuration)
,
ALL_GROUPS
,
NO_GROUPS
,
DiscoveryPermission
,
getGroups()
public void removeGroups(String[] oldGroups)
removeGroups
in interface DiscoveryGroupManagement
oldGroups
- groups to remove
IllegalStateException
- this exception occurs when
this method is called after the terminate
method has been called.
UnsupportedOperationException
- there is no set of
groups from which to removeDiscoveryGroupManagement.addGroups(java.lang.String[])
|
GigaSpaces XAP 9.7.2 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |