abstract class AbstractLookupDiscovery extends Object implements DiscoveryManagement, DiscoveryGroupManagement
Modifier and Type | Class and Description |
---|---|
private static class |
AbstractLookupDiscovery.AnnouncementInfo
Holder class for the time and sequence number of the last
received announcement.
|
private class |
AbstractLookupDiscovery.AnnouncementListener
Thread that listens for multicast announcements from lookup services.
|
private class |
AbstractLookupDiscovery.AnnouncementTimerThread
This thread monitors the multicast announcements sent from the
lookup service(s) that have already been discovered by this class,
looking for indications that those announcements have terminated.
|
private static class |
AbstractLookupDiscovery.CheckGroupsMarker
Marker object placed in pendingDiscoveries set to indicate to
UnicastDiscoveryTask that the groups of the lookup service which sent
the contained announcement need to be verified.
|
private static class |
AbstractLookupDiscovery.CheckReachabilityMarker
Marker object placed in pendingDiscoveries set to indicate to
UnicastDiscoveryTask that reachability of the lookup service which sent
the contained unicast response needs to be verified.
|
private class |
AbstractLookupDiscovery.DecodeAnnouncementTask
Task which decodes received multicast announcement packets.
|
private static class |
AbstractLookupDiscovery.Initializer |
private class |
AbstractLookupDiscovery.Notifier
Thread that retrieves data structures of type NotifyTask from a
queue and, based on the contents of the data structure, sends the
appropriate event (discovered/discarded/changed) to each registered
listener.
|
private static class |
AbstractLookupDiscovery.NotifyTask
Data structure containing task data processed by the Notifier Thread
|
private class |
AbstractLookupDiscovery.Requestor
Thread that periodically sends out multicast requests for a limited
period of time, and then exits.
|
private class |
AbstractLookupDiscovery.ResponseListener
Thread that listens for multicast responses to the multicast requests
sent out by the Requestor Thread class.
|
private class |
AbstractLookupDiscovery.UnicastDiscoveryTask
Task which retrieves elements from the set of pendingDiscoveries and
performs the appropriate processing based on the object type of
the element.
|
Modifier and Type | Field and Description |
---|---|
private boolean |
all_groups
If groups passed to constructor are null -- ALL_GROUPS, writes synchronised on registrars
|
private AbstractLookupDiscovery.AnnouncementListener |
announceeThread
Thread that handles incoming multicast announcements.
|
private AbstractLookupDiscovery.AnnouncementTimerThread |
announcementTimerThread
Thread that monitors multicast announcements from already-discovered
lookup services and, upon determining that those announcements have
stopped, queues a reachability test with the UnicastDiscoveryTask
which will ultimately result in the lookup service being discarded
if the reachability test indicates that the lookup service is
actually down.
|
private static int |
CHANGED |
private static String |
COMPONENT_NAME |
private static int |
DEFAULT_MAX_PACKET_SIZE
Default maximum size of multicast packets to send and receive.
|
private static int |
DEFAULT_MULTICAST_TTL
Default time to live value to use for sending multicast packets.
|
private static int |
DEFAULT_SOCKET_TIMEOUT
Default timeout to set on sockets used for unicast discovery.
|
private static int |
DISCARDED |
private static int |
DISCOVERED
Constants used to tell the notifierThread the type of event to send
|
private WakeupManager |
discoveryWakeupMgr |
private java.util.concurrent.ExecutorService |
executor
ExecutorService for running UnicastDiscoveryTasks and
DecodeAnnouncementTasks.
|
private long |
finalMulticastRequestInterval |
private Set<String> |
groups
The groups to discover.
|
private long |
initialMulticastRequestDelayRange |
private boolean |
initialRequestorStarted |
private boolean |
isDefaultWakeupMgr |
private List<DiscoveryListener> |
listeners
Set of listeners to be sent discovered/discarded/changed events.
|
private static Logger |
logger |
private static int |
MAX_N_TASKS
Maximum number of concurrent tasks that can be run in any executor
created by this class.
|
private DiscoveryConstraints |
multicastAnnouncementConstraints |
private long |
multicastAnnouncementInterval |
private DiscoveryConstraints |
multicastRequestConstraints |
private String |
multicastRequestHost |
private long |
multicastRequestInterval |
private int |
multicastRequestMax |
private int |
nicRetryInterval |
private NetworkInterface[] |
nics |
private static int |
NICS_USE_ALL
Constants used to indicate the set of network interfaces being used
|
private static int |
NICS_USE_LIST |
private static int |
NICS_USE_NONE |
private static int |
NICS_USE_SYS |
private int |
nicsToUse
Flag that indicates how the set of network interfaces was configured
|
private AbstractLookupDiscovery.Notifier |
notifierThread
Thread that handles pending notifications.
|
private Set |
pendingDiscoveries
Set that takes one of the following:
Socket (discovery from multicast request/response exchange)
LookupLocator (discovery from multicast announcement)
CheckGroupsMarker (discarded/changed from announcement)
CheckReachabilityMarker (announcements stopped, tests reachability)
Each element of this set represents a potential (or pending) discovered,
discarded, or changed event.
|
private java.util.concurrent.BlockingDeque<AbstractLookupDiscovery.NotifyTask> |
pendingNotifies
Notifications to be sent to listeners.
|
private Discovery |
protocol2 |
private InvocationConstraints |
rawUnicastDiscoveryConstraints |
private java.util.concurrent.ConcurrentMap<ServiceID,AbstractLookupDiscovery.AnnouncementInfo> |
regInfo
Map from ServiceID to multicast announcement time stamps; used by the
process that monitors multicast announcements from already-discovered
lookup services, and determines when those announcements have stopped.
|
private ProxyPreparer |
registrarPreparer |
private Map<ServiceID,UnicastResponse> |
registrars
Map from ServiceID to UnicastResponse.
|
private Collection<Thread> |
requestors
Collection that contains instances of the Requestor Thread class,
each of which participate in multicast discovery by periodically
sending out multicast discovery requests for a finite period of time.
|
private AbstractLookupDiscovery.ResponseListener |
respondeeThread
Thread that manages incoming multicast responses.
|
private SecurityContext |
securityContext
Security context that contains the access control context to restore
for callbacks, etc.
|
private boolean |
started |
private boolean |
terminated
Flag indicating whether or not this class is still functional.
|
private Exception |
thrown |
private List<WakeupManager.Ticket> |
tickets |
private long |
unicastDelayRange |
ALL_GROUPS, NO_GROUPS
Modifier | Constructor and Description |
---|---|
(package private) |
AbstractLookupDiscovery(String[] groups)
Construct a new lookup discovery object, set to discover the
given set of groups.
|
private |
AbstractLookupDiscovery(String[] groups,
AbstractLookupDiscovery.Initializer init) |
(package private) |
AbstractLookupDiscovery(String[] groups,
Configuration config)
Constructs a new lookup discovery object, set to discover the
given set of groups, and having the given
Configuration . |
Modifier and Type | Method and Description |
---|---|
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.
|
private void |
addNotify(List<DiscoveryListener> notifies,
Map<ServiceRegistrar,String[]> groupsMap,
int eventType)
Add a notification task to the pending queue, and wake up the Notifier.
|
private void |
checkAnnouncementConstraints(MulticastAnnouncement ann) |
private static void |
checkGroups(String[] groups)
Determines if the caller has discovery permission for each group.
|
private static String[] |
collectionToStrings(Collection c)
Converts a collection to an array of strings.
|
private MulticastAnnouncement |
decodeMulticastAnnouncement(DatagramPacket pkt)
Decodes received multicast announcement packet.
|
private Map<ServiceRegistrar,String[]> |
deepCopy(Map<ServiceRegistrar,String[]> groupsMap)
Creates and returns a deep copy of the input parameter.
|
void |
discard(ServiceRegistrar reg)
Discard a registrar from the set of registrars already
discovered.
|
private UnicastResponse |
doUnicastDiscovery(Socket socket,
DiscoveryConstraints unicastDiscoveryConstraints) |
private UnicastResponse |
doUnicastDiscovery(Socket socket,
DiscoveryConstraints unicastDiscoveryConstraints,
Discovery disco)
Performs unicast discovery over given socket based on protocol in use,
applying configured security constraints (if any).
|
private DatagramPacket[] |
encodeMulticastRequest(MulticastRequest req)
Encodes outgoing multicast requests based on protocol in use, applying
configured security constraints (if any).
|
private String[] |
getActualGroups(ServiceRegistrar reg)
This method retrieves from the given
ServiceRegistrar ,
the current groups in which that registrar is a member. |
private Discovery |
getDiscovery(int version)
Returns Discovery instance for the given version, or throws
DiscoveryProtocolException if the version is unsupported.
|
String[] |
getGroups()
Return the set of group names this LookupDiscovery instance is
trying to discover.
|
private static String |
getLocalHost()
Returns the local host name.
|
ServiceRegistrar[] |
getRegistrars()
Returns an array of instances of
ServiceRegistrar , each
corresponding to a proxy to one of the currently discovered lookup
services. |
private ServiceID[] |
getServiceIDs()
Returns the service IDs of the lookup service(s) discovered to date.
|
private static boolean |
groupSetsEqual(String[] groupSet0,
String[] groupSet1)
Determines if two sets of registrar member groups have identical
contents.
|
private boolean |
groupsOverlap(String[] possibilities)
Indicate whether any of the group names in the given array match
any of the groups of interest.
|
(package private) static AbstractLookupDiscovery.Initializer |
init(Configuration config) |
(package private) static AbstractLookupDiscovery.Initializer |
initEmptyConf() |
private Map<ServiceRegistrar,String[]> |
mapRegToGroups(ServiceRegistrar reg,
String[] curGroups)
Convenience method that creates and returns a mapping of a single
ServiceRegistrar instance to a set of groups. |
private void |
maybeAddNewRegistrar(UnicastResponse resp)
If the lookup service associated with the given UnicastResponse
is not in the set of already-discovered lookup services, this method
adds it to that set, and each registered listener is notified.
|
private void |
maybeDiscardRegistrars()
Determine if any of the already-discovered registrars are no longer
members of any of the groups to discover, and discard those registrars
that are no longer members of any of those groups.
|
private void |
maybeSendEvent(UnicastResponse response,
String[] newGroups)
After a possible change in the member groups of the
ServiceRegistrar corresponding to the given
UnicastResponse parameter, this method
determines whether or not the registrar's member groups have
changed in such a way that either a changed event or a discarded
event is warranted. |
private void |
notifyOnGroupChange(ServiceRegistrar reg,
String[] oldGroups,
String[] newGroups)
After a possible change in the member groups of the given
ServiceRegistrar parameter, this method compares
the registrar's original set of member groups to its new set
of member groups. |
private void |
nukeThreads()
Terminates (interrupts) all currently-running threads.
|
private static void |
prepareSocket(Socket s,
DiscoveryConstraints dc) |
private static boolean |
registrarsEqual(UnicastResponse resp1,
UnicastResponse resp2)
Returns true if the registrars contained in the given (possibly null)
UnicastResponse instances are equals() to one another.
|
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.
|
private boolean |
removeGroupsInt(String[] oldGroups)
Remove the specified groups from the set of groups to discover, and
return true if any were actually removed.
|
private void |
requestGroups(Collection req)
Called at startup and whenever the set of groups to discover is
changed.
|
private void |
restoreContextAddTask(Runnable t) |
private WakeupManager.Ticket |
restoreContextScheduleRunnable(AbstractLookupDiscovery.UnicastDiscoveryTask t) |
private void |
sendChanged(ServiceRegistrar reg,
String[] curGroups)
Convenience method that sends a changed event containing only
one registrar to all registered listeners that are interested in
such events.
|
private void |
sendDiscarded(ServiceRegistrar reg,
String[] curGroups)
Convenience method that sends a discarded event containing only
one registrar to all registered listeners.
|
private static void |
sendPacket(MulticastSocket mcSocket,
DatagramPacket[] packet)
Sends the given packet data on the given
MulticastSocket
through the network interface that is currently set. |
private void |
sendPacketByNIC(MulticastSocket mcSocket,
DatagramPacket[] packet)
Sends the given packet data on the given
MulticastSocket
through each of the network interfaces corresponding to elements of
the array configured when this utility was constructed. |
void |
setGroups(String[] newGroups)
Change the set of groups to be discovered to correspond to the
given set.
|
(package private) void |
start()
In previous releases threads were started in the constructor, however
this violates safe construction according to the JMM.
|
void |
terminate()
Terminate the discovery process.
|
private void |
terminateTaskMgr()
This method removes all pending and active tasks from the TaskManager
for this instance.
|
private static void |
testArrayForNullElement(String[] groupArray)
This method is used by the public methods of this class that are
specified to throw a
NullPointerException when the given
array of group names contains one or more null elements;
in which case, this method throws a NullPointerException
which should be allowed to propagate outward. |
(package private) static String[] |
verifyGroups(String[] groups) |
private static final String COMPONENT_NAME
private static final Logger logger
private static final int MAX_N_TASKS
private static final int DEFAULT_MAX_PACKET_SIZE
private static final int DEFAULT_MULTICAST_TTL
private static final int DEFAULT_SOCKET_TIMEOUT
private volatile boolean terminated
private final List<DiscoveryListener> listeners
private final Set<String> groups
private volatile boolean all_groups
private final Map<ServiceID,UnicastResponse> registrars
private final Set pendingDiscoveries
Each element of this set represents a potential (or pending) discovered, discarded, or changed event. Instances of UnicastDiscoveryTask retrieve the next available element from this set and, based on the object type of the element, determines the processing to perform and what event type to send to the registered listeners.
private final AbstractLookupDiscovery.Notifier notifierThread
private final java.util.concurrent.BlockingDeque<AbstractLookupDiscovery.NotifyTask> pendingNotifies
private final java.util.concurrent.ExecutorService executor
private final WakeupManager discoveryWakeupMgr
private final boolean isDefaultWakeupMgr
private final List<WakeupManager.Ticket> tickets
private final AbstractLookupDiscovery.AnnouncementListener announceeThread
private final Collection<Thread> requestors
private volatile AbstractLookupDiscovery.ResponseListener respondeeThread
private final SecurityContext securityContext
private final java.util.concurrent.ConcurrentMap<ServiceID,AbstractLookupDiscovery.AnnouncementInfo> regInfo
private final AbstractLookupDiscovery.AnnouncementTimerThread announcementTimerThread
private final ProxyPreparer registrarPreparer
private final Discovery protocol2
private final int multicastRequestMax
private final long multicastRequestInterval
private final long finalMulticastRequestInterval
private final String multicastRequestHost
private final DiscoveryConstraints multicastRequestConstraints
private final NetworkInterface[] nics
private final int nicRetryInterval
private final long multicastAnnouncementInterval
private final long unicastDelayRange
private final long initialMulticastRequestDelayRange
private boolean initialRequestorStarted
private final DiscoveryConstraints multicastAnnouncementConstraints
private final InvocationConstraints rawUnicastDiscoveryConstraints
private static final int DISCOVERED
private static final int DISCARDED
private static final int CHANGED
private static final int NICS_USE_ALL
private static final int NICS_USE_SYS
private static final int NICS_USE_LIST
private static final int NICS_USE_NONE
private final int nicsToUse
private final Exception thrown
private boolean started
AbstractLookupDiscovery(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 elementIOException
- an exception occurred in starting discoveryDiscoveryGroupManagement.NO_GROUPS
,
DiscoveryGroupManagement.ALL_GROUPS
,
setGroups(java.lang.String[])
,
DiscoveryPermission
AbstractLookupDiscovery(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 classNullPointerException
- input array contains at least
one null
element or null
is input
for the configurationIOException
- an exception occurred in starting discoveryConfigurationException
- indicates an exception
occurred while retrieving an item from the given
Configuration
DiscoveryGroupManagement.NO_GROUPS
,
DiscoveryGroupManagement.ALL_GROUPS
,
setGroups(java.lang.String[])
,
DiscoveryPermission
,
Configuration
,
ConfigurationException
private AbstractLookupDiscovery(String[] groups, AbstractLookupDiscovery.Initializer init)
static String[] verifyGroups(String[] groups) throws NullPointerException, SecurityException
static AbstractLookupDiscovery.Initializer initEmptyConf() throws IOException
IOException
static AbstractLookupDiscovery.Initializer init(Configuration config) throws IOException, ConfigurationException
IOException
ConfigurationException
void start() throws IOException
Threads will be started automatically when a DiscoveryListener
is added, if start hasn't been called.
IOException
public void addDiscoveryListener(DiscoveryListener l)
addDiscoveryListener
in interface DiscoveryManagement
l
- the listener to registerNullPointerException
- 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 unregisterIllegalStateException
- 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 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 discardIllegalStateException
- 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.DiscoveryGroupManagement.NO_GROUPS
,
DiscoveryGroupManagement.ALL_GROUPS
,
setGroups(java.lang.String[])
public void addGroups(String[] newGroups) throws IOException
addGroups
in interface DiscoveryGroupManagement
newGroups
- the groups to addIOException
- the multicast request protocol failed
to startIllegalStateException
- 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 discoveryIllegalStateException
- this exception occurs when
this method is called after the terminate
method has been called.#LookupDiscovery
,
DiscoveryGroupManagement.ALL_GROUPS
,
DiscoveryGroupManagement.NO_GROUPS
,
DiscoveryPermission
,
getGroups()
public void removeGroups(String[] oldGroups)
removeGroups
in interface DiscoveryGroupManagement
oldGroups
- groups to removeIllegalStateException
- 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[])
private void sendPacketByNIC(MulticastSocket mcSocket, DatagramPacket[] packet) throws InterruptedIOException
MulticastSocket
through each of the network interfaces corresponding to elements of
the array configured when this utility was constructed.mcSocket
- the MulticastSocket
on which the data
will be sentpacket
- DatagramPacket
array whose elements are
the data to sendInterruptedIOException
private static void sendPacket(MulticastSocket mcSocket, DatagramPacket[] packet) throws IOException
MulticastSocket
through the network interface that is currently set.mcSocket
- the MulticastSocket
on which the data
will be sentpacket
- DatagramPacket
array whose elements are
the data to sendIOException
private static String getLocalHost() throws UnknownHostException
UnknownHostException
private static void checkGroups(String[] groups)
private static final String[] collectionToStrings(Collection c)
private static boolean groupSetsEqual(String[] groupSet0, String[] groupSet1)
groupSet0
- String
array containing the group
names from the first set used in the comparisongroupSet1
- String
array containing the group
names from the second set used in the comparisontrue
if the contents of each set is identical;
false
otherwiseprivate static boolean registrarsEqual(UnicastResponse resp1, UnicastResponse resp2)
private boolean removeGroupsInt(String[] oldGroups)
private ServiceID[] getServiceIDs()
private boolean groupsOverlap(String[] possibilities)
possibilities
- the set of group names to compare to the set
of groups to discover (must not be null)private void requestGroups(Collection req) throws IOException
IOException
private static void prepareSocket(Socket s, DiscoveryConstraints dc) throws SocketException
SocketException
private void maybeAddNewRegistrar(UnicastResponse resp)
resp
- the UnicastResponse associated with the lookup
service to addprivate void maybeDiscardRegistrars()
private void addNotify(List<DiscoveryListener> notifies, Map<ServiceRegistrar,String[]> groupsMap, int eventType)
private void nukeThreads()
private void terminateTaskMgr()
private void maybeSendEvent(UnicastResponse response, String[] newGroups)
ServiceRegistrar
corresponding to the given
UnicastResponse
parameter, this method
determines whether or not the registrar's member groups have
changed in such a way that either a changed event or a discarded
event is warranted.
Note that even if the contents of the new set of groups initially indicate that the corresponding registrar is a candidate for a discarded or a changed event, further analysis must be performed. This is because there is no guarantee that the new set of member groups have not been "split" across the multicast announcements sent by the lookup service; and so there is no guarantee that the contents of the new group set actually reflect a change that warrants an event. To guarantee that the new group set accurately reflects the registrar's member groups, this method makes a remote call to the registrar to retrieve its actual member groups.
There is one situation where it is not necessary to query the
registrar for its current member groups. That situation is
when the set of groups input to the newGroups
parameter
is equivalent to NO_GROUPS. If that new group set is equivalent
to NO_GROUPS, it is guaranteed that the registrar's member groups
have not been split across the multicast announcements.
response
- instance of UnicastResponse
corresponding to the registrar whose current and
previous member groups are to be comparednewGroups
- String
array containing the new
member groups of the registrar corresponding to the
response
parameter (just after a
possible change)private void notifyOnGroupChange(ServiceRegistrar reg, String[] oldGroups, String[] newGroups)
ServiceRegistrar
parameter, this method compares
the registrar's original set of member groups to its new set
of member groups.
If the criteria shown below is satisfied, either a discarded event or a changed event will be sent to any registered listeners. The criteria is based on whether the old and new groups are equal, and whether one or more elements of the new group set also belong to the set of groups to discover (the new groups are "still of interest"). The criteria is as follows:
if (old groups and new groups)
reg
- instance of ServiceRegistrar
corresponding to the registrar whose current and
previous member groups are to be compared; and
whose corresponding service ID is used as the key
into the various data structures that contain
pertinent information about that registraroldGroups
- String
array containing the member
groups of the reg
parameter prior to
being changednewGroups
- String
array containing the current
member groups of the reg
parameter
(just after a possible change)private void sendDiscarded(ServiceRegistrar reg, String[] curGroups)
reg
- instance of ServiceRegistrar
corresponding to the registrar to include in the
eventcurGroups
- String
array containing the current
member groups of the registrar referenced by the
reg
parameterprivate void sendChanged(ServiceRegistrar reg, String[] curGroups)
reg
- instance of ServiceRegistrar
corresponding to the registrar to include in the
eventcurGroups
- String
array containing the current
member groups of the registrar referenced by the
reg
parameterprivate Map<ServiceRegistrar,String[]> deepCopy(Map<ServiceRegistrar,String[]> groupsMap)
groupsMap
- mapping from a set of registrars to the member groups
of each registrarprivate String[] getActualGroups(ServiceRegistrar reg)
ServiceRegistrar
,
the current groups in which that registrar is a member. If the
registrar is un-reachable, then this method will discard the
registrar.reg
- instance of ServiceRegistrar
referencing the
registrar whose member groups are to be retrieved and returnedString
array containing the current member groups
of the registrar referenced by the reg
parameterprivate Map<ServiceRegistrar,String[]> mapRegToGroups(ServiceRegistrar reg, String[] curGroups)
ServiceRegistrar
instance to a set of groups.reg
- instance of ServiceRegistrar
corresponding to the registrar to use as the key
to the mappingcurGroups
- String
array containing the current
member groups of the registrar referenced by the
reg
parameter; and which is used
as the value of the mappingMap
instance containing a single mapping from
a given registrar to its current member groupsprivate static void testArrayForNullElement(String[] groupArray)
NullPointerException
when the given
array of group names contains one or more null
elements;
in which case, this method throws a NullPointerException
which should be allowed to propagate outward.NullPointerException
- this exception occurs when
one or more of the elements of the groupArray
parameter is null
.private MulticastAnnouncement decodeMulticastAnnouncement(DatagramPacket pkt) throws IOException
IOException
private void checkAnnouncementConstraints(MulticastAnnouncement ann) throws IOException
IOException
private DatagramPacket[] encodeMulticastRequest(MulticastRequest req) throws IOException
IOException
private void restoreContextAddTask(Runnable t)
private WakeupManager.Ticket restoreContextScheduleRunnable(AbstractLookupDiscovery.UnicastDiscoveryTask t)
private UnicastResponse doUnicastDiscovery(Socket socket, DiscoveryConstraints unicastDiscoveryConstraints, Discovery disco) throws IOException, ClassNotFoundException
IOException
ClassNotFoundException
private UnicastResponse doUnicastDiscovery(Socket socket, DiscoveryConstraints unicastDiscoveryConstraints) throws IOException, ClassNotFoundException
IOException
ClassNotFoundException
private Discovery getDiscovery(int version) throws DiscoveryProtocolException
DiscoveryProtocolException
Copyright 2007-2013, multiple authors.
Licensed under the Apache License, Version 2.0, see the NOTICE file for attributions.