private final class AbstractLookupDiscoveryManager.GroupDiscoveryListener extends AbstractLookupDiscoveryManager.LocatorDiscoveryListener implements DiscoveryChangeListener
LookupDiscovery
that performs group discovery
on behalf of this LookupDiscoveryManager
.Modifier | Constructor and Description |
---|---|
private |
GroupDiscoveryListener() |
Modifier and Type | Method and Description |
---|---|
void |
changed(DiscoveryEvent e)
Called by
LookupDiscovery to send a changed event
to this listener when that LookupDiscovery has
determined that the member groups of a previously discovered
registrar (reg) have changed. |
void |
discarded(DiscoveryEvent e)
Called by
LookupDiscovery to send a discarded event
to this listener when one of the following events occurs
affecting at least one registrar (reg) that was previously
discovered through either group discovery alone, or through
both group and locator discovery:
The method LookupDiscovery.discard was
called because the reg was determined to be unreachable. |
void |
discovered(DiscoveryEvent e)
Called by
LookupDiscovery to send a discovered event
to this listener when that LookupDiscovery has
discovered at least one registrar (reg) belonging to at least one
of the groups desired by this LookupDiscoveryManager . |
removeDiscoveredSet
public void discovered(DiscoveryEvent e)
LookupDiscovery
to send a discovered event
to this listener when that LookupDiscovery
has
discovered at least one registrar (reg) belonging to at least one
of the groups desired by this LookupDiscoveryManager
.
The reg(s) referenced in the given discovered event may,
or may not, have also been previously discovered through locator
discovery.
If this LookupDiscoveryManager
has no prior knowledge
of a particular reg referenced in the given discovered event when
the LookupDiscovery
invokes this method, then this
method will send to the listeners registered with this
LookupDiscoveryManager
, a discovered event
referencing that reg; otherwise, depending on whether or not
the set of member groups referenced in the given discovered
event equal the member groups currently associated with the
reg from that event, this method may send a changed event, or
may simply update state and send no event at all.discovered
in interface DiscoveryListener
discovered
in class AbstractLookupDiscoveryManager.LocatorDiscoveryListener
e
- the event that describes the discovered registrarspublic void discarded(DiscoveryEvent e)
LookupDiscovery
to send a discarded event
to this listener when one of the following events occurs
affecting at least one registrar (reg) that was previously
discovered through either group discovery alone, or through
both group and locator discovery:
LookupDiscovery.discard
was
called because the reg was determined to be unreachable.
In this case, the discarded event received from the
LookupDiscovery
is referred to as an
"active communication discard".
LookupDiscovery
has determined that the
reg has stopped sending multicast announcements.
In this case, the discarded event received from the
LookupDiscovery
is referred to as a
"passive communication discard".
setGroups
or the method
removeGroups
has been called on the
LookupDiscovery
, and the resulting new set
of desired groups no longer intersects the set of member
groups of the discarded reg. In this case, the discarded
event received from the LookupDiscovery
is
referred to as an "active no-interest discard".
LookupDiscovery
is
referred to as a "passive no-interest discard".
Depending on the type of discarded event received from the
LookupDiscovery
as described above, and depending
on whether the discarded reg was previously discovered by group
discovery alone, or by both group and locator discovery, this
method will determine whether to send a discarded event, a changed
event, or no event at all. Note that because the discarded event
was sent by the LookupDiscovery
, the discarded reg
could not have been previously discovered by locator discovery
alone. Note also that even though a discarded event is received
by this method, there are conditions in which a changed event
is ultimately sent to the listeners registered with this
LookupDiscoveryManager
(see below).
The following describes the logic used by this method to determine
whether or not to send an event to the registered listeners of
this LookupDiscoveryManager
, as well as what type
of event to send. Note that this method concludes that the
current discarded event must be a communication discard when the
the set of desired groups still intersects the discarded reg's
current set of member groups. This is because when interest in
the reg still exists, LookupDiscovery
will discard
the reg only when it has determined that the reg is unreachable.
Thus, for a particular reg referenced in the given discarded event,
LookupDiscovery
are identical to the
previously discovered member groups of that reg, and if
if those member groups still intersect the current set of
desired groups (still interested in the reg), then this
method will conclude that the discarded event must be either
an active or a passive communication discard. When the
discard is a communication discard (either active or
passive), if the reg was previously discovered by only group
discovery, this method sends a discarded event. But if the
reg was previously discovered by locator discovery as well
as group discovery, then rather than sending a discarded
event here, LookupLocatorDiscovery.discard
is called (through a call to reg.discard
),
which will send a discarded event to
LocatorDiscoveryListener
, which then
ultimately sends a discarded event to the registered
listeners of this LookupDiscoveryManager
.
LookupDiscovery
are identical to the
previously discovered member groups of that reg, but those
member groups NO LONGER intersect the current set of desired
groups, then this method will conclude that the discarded
event must be an active no-interest discard. When the
discard is an active no-interest discard, if the discarded
reg was previously discovered by ONLY group discovery, then
a discarded event is sent; otherwise, no event is sent
(see section DU.2.4.1 of the "Jini Discovery Utilities
Specification").
LookupDiscovery
neither intersect the
current set of desired groups (indicating no interest), nor
are they identical to the previously discovered member
groups of that reg (the member groups have changed), this
method will conclude that the discarded event must be a
passive no-interest discard. When the discard is a passive
no-interest discard, if the discarded reg was previously
discovered by locator discovery as well as group discovery,
a changed event is is sent to the appropriate listeners;
otherwise a discarded event is sent. A changed event is
sent when the reg was previously discovered by both group
and locator discovery because the fact that the reg was
discovered via locator discovery indicates continued
interest in the reg, even though the reg was discarded with
respect to group discovery. In this case, since the member
groups have actually changed (changed in such a way that the
LookupDiscovery
sent a discarded event), and
since there is still interest in that reg, it is more
appropriate to send a changed event here rather than a
discarded event.
The logic described above can be collapsed into the following decision process:
if(discovered by group discovery alone) { send discarded event } else {//discovered by both group and locator discovery if(NO LONGER interested in member groups) { if(member group have changed) { send changed event } } else {//still interested in member groups call discard on LookupLocatorDiscovery } }
discarded
in interface DiscoveryListener
discarded
in class AbstractLookupDiscoveryManager.LocatorDiscoveryListener
e
- the event that describes the discarded registrarspublic void changed(DiscoveryEvent e)
LookupDiscovery
to send a changed event
to this listener when that LookupDiscovery
has
determined that the member groups of a previously discovered
registrar (reg) have changed. This method extracts and records
the appropriate information from the given changed event, and
then sends a changed event to the appropriate listeners registered
with this LookupDiscoveryManager
.changed
in interface DiscoveryChangeListener
e
- instance of net.jini.discovery.DiscoveryEvent
representing the event that describes the lookup services
whose discovery state has changedCopyright 2007-2013, multiple authors.
Licensed under the Apache License, Version 2.0, see the NOTICE file for attributions.