class AbstractLookupDiscoveryManager.LocatorDiscoveryListener extends Object implements DiscoveryListener
LookupLocatorDiscovery
that performs locator discovery
on behalf of this LookupDiscoveryManager
.Constructor and Description |
---|
LocatorDiscoveryListener() |
Modifier and Type | Method and Description |
---|---|
void |
discarded(DiscoveryEvent e)
Called by
LookupLocatorDiscovery 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 locator discovery alone, or through
both group and locator discovery:
The method LookupLocatorDiscovery.discard
was called because the reg was determined to be unreachable
(this is referred to as a "communication discard"). |
void |
discovered(DiscoveryEvent e)
Called by the
LookupLocatorDiscovery to
send a discovered event to this listener when that
LookupLocatorDiscovery has discovered at least
one registrar (reg) having a locator equal one of the locators
desired by this LookupDiscoveryManager . |
(package private) boolean |
removeDiscoveredSet(AbstractLookupDiscoveryManager.ProxyReg reg,
int from) |
public void discovered(DiscoveryEvent e)
LookupLocatorDiscovery
to
send a discovered event to this listener when that
LookupLocatorDiscovery
has discovered at least
one registrar (reg) having a locator equal one of the locators
desired by this LookupDiscoveryManager
.
The reg(s) referenced in the given discovered event may,
or may not, have also been previously discovered through group
discovery.
If this LookupDiscoveryManager
has no prior knowledge
of a particular reg referenced in the given discovered event when
the LookupLocatorDiscovery
invokes this method, then
this method will send to the listeners registered with this
LookupDiscoveryManager
, a discovered event
referencing that reg; otherwise, it will simply update state
and send no event at all.discovered
in interface DiscoveryListener
e
- the event that describes the discovered registrarspublic void discarded(DiscoveryEvent e)
LookupLocatorDiscovery
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 locator discovery alone, or through
both group and locator discovery:
LookupLocatorDiscovery.discard
was called because the reg was determined to be unreachable
(this is referred to as a "communication discard").
setLocators
or the method
removeLocators
was called on the
LookupLocatorDiscovery
, and the resulting new
set of desired locators no longer contains an element
equal to the locator of the discarded reg (this is referred
to as a "no-interest discard").
Depending on the type of discarded event received from the
LookupLocatorDiscovery
as described above, and
depending on whether the discarded reg was previously discovered
by locator discovery alone, or by both group and locator discovery,
this method will determine whether or not to pass a discarded
event on to the client's listener. (Note that because the discarded
event was sent by the LookupLocatorDiscovery
,
the discarded reg could not have been previously discovered by
group discovery alone.)
The following describes the logic used by this method to determine
whether or not to send a discarded event to the client listeners
registered with this LookupDiscoveryManager
. Note
that since the LookupLocatorDiscovery
is accessible
only from within this LookupDiscoveryManager
, the
method LookupLocatorDiscovery.discard
is never called
from "outside" of this LookupDiscoveryManager
.
This fact is exploited to communicate to this method that a
communication discard has occurred. That is, when
LookupDiscoveryManager.discard
is called, a boolean
associated with the discarded reg is set to true
to
indicate that a communication discard has occurred.
Thus, for a particular reg referenced in the given discarded event,
LookupDiscoveryManager.discard
, then this
method will conclude that the discarded event must be a
communication discard (indicated by the value of the
boolean set by LookupDiscoveryManager.discard
and associated with the discarded reg). When the discard is
a communication discard, if the reg was previously
discovered by only locator discovery, this method sends a
discarded event. But if the reg was previously discovered
by group discovery as well as locator discovery,
then rather than sending a discarded event here,
LookupDiscovery.discard
is called (through
a call to reg.discard
), which will send a
discarded event to GroupDiscoveryListener
, which
then ultimately sends a discarded event to the registered
listeners of this LookupDiscoveryManager
.
LookupDiscoveryManager.discard
(is not a
communication discard), then this method will conclude
that the discarded event must be a no-interest discard.
When the discard is a no-interest discard, if the discarded
reg was previously discovered by ONLY locator discovery,
then a discarded event is sent; otherwise, no event is sent
(see section DU.2.5.1 of the "Jini Discovery Utilities
Specification").
The logic described above can be collapsed into the following decision process:
if(discovered by locator discovery alone) { send discarded event } else {//discovered by both group and locator discovery if(communication discard) { call discard on LookupDiscovery } }
discarded
in interface DiscoveryListener
e
- the event that describes the discarded registrarsboolean removeDiscoveredSet(AbstractLookupDiscoveryManager.ProxyReg reg, int from)
Copyright 2007-2013, multiple authors.
Licensed under the Apache License, Version 2.0, see the NOTICE file for attributions.