private final class FiddlerImpl.ChangedEventTask extends Object implements Runnable
Task
object that is placed
in the TaskManager
queue for processing in the thread
pool. An instance of this class is placed on the task queue when a
DiscoveryEvent
instance indicating a changed event
is received from the local discovery process.
The run
method of this class will process event
information resulting from a change in the state of the member
groups of one or more lookup services (registrars). This task
analyzes the group information in the event and, based on that
information, determines which active registrations are no longer
interested in the registrars referenced in the event. A
RemoteDiscoveryEvent
indicating a discarded event
will be sent to each active registration that has lost interest
in any of the registrars of the event.
Modifier and Type | Field and Description |
---|---|
DiscoveryEvent |
event
The local event sent by the discovery manager.
|
Constructor and Description |
---|
ChangedEventTask(DiscoveryEvent event)
Constructs an instance of this class and stores the event
|
Modifier and Type | Method and Description |
---|---|
private HashSet |
maybeSendDiscardedEvent(FiddlerImpl.RegistrationInfo regInfo,
Map groupsMap,
Map locatorMap)
This method determines, based on the current state of the
regInfo parameter, whether or not to send a
remote discarded event to the regInfo's listener, and then builds
and sends the event if appropriate. |
void |
run()
This method processes the local discovery event information and
determines, based on the current state of each active
registration, to which such registration the appropriate
RemoteDiscoveryEvent should be sent. |
public final DiscoveryEvent event
public ChangedEventTask(DiscoveryEvent event)
public void run()
RemoteDiscoveryEvent
should be sent. After making
the determination, the remote event appropriate for each
registration is constructed and sent.private HashSet maybeSendDiscardedEvent(FiddlerImpl.RegistrationInfo regInfo, Map groupsMap, Map locatorMap)
regInfo
parameter, whether or not to send a
remote discarded event to the regInfo's listener, and then builds
and sends the event if appropriate. This method is called in
response to the receipt of a changed event from the discovery
manager.
Such an event may indicate what is referred to as a "passive, no interest" discard; passive because the event resulted from action taken by the discovery manager rather than the client, and no interest because the discovery manager sends such an event when it determines that one or more of the previously discovered registrars - although still reachable - have changed their member groups in such a way that they may now be of no interest to one or more of the client registrations.
Note that changed events can be sent for registrars having a locator and member groups that the current regInfo never asked to be discovered. This can happen because some other regInfo asked that the registrar's locator or groups be discovered.
If a particular registrar is contained in the discovered set of the given regInfo, then we know that that regInfo must have requested discovery of the registrar (through either locator or group discovery). If the registrar is not contained in that set, then there's no need to proceed with the processing of the registrar since we don't want to send a discarded event to a regInfo that was never interested in that registrar in the first place.
If the locator of the registrar is contained in the regInfo's set of locators to discover, then that regInfo is considered "still interested" in the registrar; and so no discarded event is sent to the regInfo.
Thus, a discarded event is sent to the given regInfo only if the regInfo is not interested in discovering the registrar through locator discovery, and the registrar's member groups have changed in such a way that it now belongs to groups that the regInfo is not interested in discovering and joining.
regInfo
- the data structure record corresponding to the
registration whose listener will receive the eventgroupsMap
- mapping from the registrars referenced in the
just-received event to their corresponding set of
member groupslocatorMap
- mapping from the registrars referenced in the
just-received event to their corresponding locatorCopyright 2007-2013, multiple authors.
Licensed under the Apache License, Version 2.0, see the NOTICE file for attributions.