Each element of the set of pendingDiscoveries is one of the following object types: Socket, LookupLocator, CheckGroupsMarker, or CheckReachabilityMarker.
When the element to process is a Socket, the element was a result of a multicast request/response exchange (see the Requestor and ResponseListener Thread classes). In this case, this task completes the discovery of the associated lookup service by performing the final stage of unicast discovery, ultimately resulting in a discovered event being sent to all registered listeners.
When the element to process is a LookupLocator, the element was a result of a multicast announcement received from a lookup service - belonging to at least one group of interest - which has not already been discovered. In this case, this task also completes the discovery of the lookup service referenced in the announcement by performing the final stage of unicast discovery, ultimately resulting in a discovered event being sent to all registered listeners.
When the element to process is a CheckGroupsMarker, the element was a result of a multicast announcement received from an already-discovered lookup service whose member groups have changed in some way. In this case, this task determines how those member groups have changed and, based on how they have changed, whether (or not) to send a discarded event or a changed event to the appropriate registered listeners.
When the element to process is a CheckReachabilityMarker, the element was a result of a determination that the multicast announcements from an already-discovered lookup service have stopped being received (see the AnnouncementTimerThread class). In this case, this task determines if the affected lookup service is still available ("reachable"). If this task cannot communicate with the lookup service, a discarded event is queued to be sent to all registered listeners.
Rather than performing unicast discovery synchronously, after multicast discovery has occurred in either the AnnouncementListener thread (the multicast announcement protocol) or the ResponseListener thread (the multicast request protocol), the unicast discovery processing that is required to complete the discovery process is queued for asynchronous execution in this task. Unicast discovery is performed asynchronously because unicast discovery can take quite a while to fail if a lookup service "disappears" (because the network or the lookup service itself has crashed) between the time a multicast announcement or response indicates the existence of a lookup service eligible for unicast discovery, and the time unicast discovery actually starts. If unicast discovery is performed synchronously in the threads that implement the multicast announcement and multicast request protocols, other multicast announcements (as well as other unicast discoveries) will be missed whenever a lookup service disappears prior to the commencement of the unicast discovery stage.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|