net.jini.discovery
Class LookupDiscoveryManager.LocatorDiscoveryListener

java.lang.Object
  extended by net.jini.discovery.LookupDiscoveryManager.LocatorDiscoveryListener
All Implemented Interfaces:
EventListener, DiscoveryListener
Direct Known Subclasses:
LookupDiscoveryManager.GroupDiscoveryListener
Enclosing class:
LookupDiscoveryManager

 class LookupDiscoveryManager.LocatorDiscoveryListener
extends Object
implements DiscoveryListener

Class that defines the listener that is registered with the LookupLocatorDiscovery that performs locator discovery on behalf of this LookupDiscoveryManager.


Constructor Summary
LookupDiscoveryManager.LocatorDiscoveryListener()
           
 
Method Summary
(package private)  void addDiscoveredSet(LookupDiscoveryManager.ProxyReg reg)
           
 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(LookupDiscoveryManager.ProxyReg reg, int from)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LookupDiscoveryManager.LocatorDiscoveryListener

LookupDiscoveryManager.LocatorDiscoveryListener()
Method Detail

discovered

public 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. 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.

Specified by:
discovered in interface DiscoveryListener
Parameters:
e - the event that describes the discovered registrars

discarded

public 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:

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,

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
          }
      }
  

Specified by:
discarded in interface DiscoveryListener
Parameters:
e - the event that describes the discarded registrars

addDiscoveredSet

void addDiscoveredSet(LookupDiscoveryManager.ProxyReg reg)

removeDiscoveredSet

boolean removeDiscoveredSet(LookupDiscoveryManager.ProxyReg reg,
                            int from)


Copyright 2007-2010, multiple authors.
Licensed under the Apache License, Version 2.0, see the NOTICE file for attributions.