* that are expected to be discovered.
*/
for(int i=0;i<locGroupsList.size();i++) {
LocatorGroupsPair pair =
(LocatorGroupsPair)locGroupsList.get(i);
LookupLocator curLoc = pair.locator;
String[] curGroups = pair.groups;
if( discoverByLocators(curLoc,locatorsToDiscover)
|| discoverAll
|| discoverByGroups(curGroups,groupsToDiscover) )
{
expectedDiscoveredMap.put(curLoc,curGroups);
}//endif
}//end loop
/* The input ArrayList contains (locator,groups) pairs that
* represent the locator and current member groups of lookup
* services that have been started. The referenced lookup
* services may have been previously discovered, and the
* current member groups may reflect some change from when
* the lookup service was previously discovered. The
* discoveredMap for this listener contains (locator,groups)
* pairs that correspond to lookup services that actually have
* been previously DISCOVERED through either locator discovery
* or through group discovery of the original member groups of
* the lookup service (or both).
*
* For any (locator,groups) pair from the discoveredMap,
* the corresponding lookup service can become no longer of
* interest. This occurs when both of the following conditions
* occur:
* - the lookup's corresponding locator is NOT referenced in
* the locatorsToDiscover parameter (so there is no
* interest in discovering that lookup service using
* locator discovery)
* - the lookup's current member groups consist of NONE of
* the groups referenced in the groupsToDiscover parameter
* (so there is no interest in discovering that lookup
* service using group discovery)
*
* Note that loss of interest in using group discovery to
* discover the lookup service can occur when one or both of
* the following conditions occurs:
* - the lookup's current member groups has changed
* - the contents of the groupsToDiscover parameter has
* changed
*
* When a combination of conditions - as described above -
* indicate that a previously discovered lookup service
* (corresponding to an element of the discoveredMap) is
* no longer of interest through either locator discovery
* or group discovery (or both), the lookup service will
* eventually be discarded. Thus, the corresponding
* (locator,groups) pair should be REMOVED from the
* expectedDiscoveredMap, and a pair having that lookup's
* corresponding locator and current member groups should
* be placed in the expectedDiscardedMap.
*
* Thus, for our purposes here, there are three conditions
* in which the lookup service will no longer be of interest:
* -- the element of discoveredMap, corresponding to the
* lookup service in question, corresponds to NONE of the
* elements of the input ArrayList
* -- the locator of the lookup service in question
* equals NONE of the elements of the locatorsToDiscover
* parameter
* -- NONE of the current member groups of the lookup
* service in question equal any of the elements of the
* groupsToDiscover parameter
*/
Set eSet = discoveredMap.entrySet();
Iterator iter = eSet.iterator();
while(iter.hasNext()) {
Map.Entry pair = (Map.Entry)iter.next();
LookupLocator loc = (LookupLocator)pair.getKey();
/* We care what the current member groups are now, as
* indicated by the contents of the input ArrayList;
* not the member groups that were originally discovered.
* If the groups of a previously discovered lookup, and/or
* the groupsToDiscover have changed in such a way that
* interest in the previously discovered lookup service
* has ceased (and we are not currently interested in
* discovering that lookup service using locator
* discovery), then we should expect that lookup service
* to be discarded.
*
* Below, the current locator from the set of previously
* discovered lookups is used to determine the current
* member groups of that lookup service. If that locator
* is contained in the input ArrayList, then the groups
* paired with the locator in that ArrayList are considered
* the most current; and they are used to determine if
* we are still interested in the lookup service. If that
* locator is not referenced in the input ArrayList, then
* we assume the lookup's current member groups are the
* groups associated with the locator when the lookup
* service was previously discovered; and those original
* groups are used to determine if we are still interested
* in the lookup service.
*/
String[] memberGroups = getGroups(loc,locGroupsList);
if(memberGroups == null) {
memberGroups = (String[])pair.getValue();
}//endif
if(isElementOf(loc,locators) &&
( discoverByLocators(loc,locatorsToDiscover)
|| discoverAll
|| discoverByGroups(memberGroups,groupsToDiscover)) )
{
continue;//still interested, go to next
}//endif
/* not interested in this lookup anymore, expect discard */
expectedDiscoveredMap.remove(loc);
expectedDiscardedMap.put(loc,memberGroups);
}//end loop
/* The input ArrayList contains (locator,groups) pairs that
* represent the locator and current member groups of lookup
* services that have been started. The referenced lookup
* services may have been previously discardred, and the
* current member groups may reflect some change from when
* the lookup service was previously discardred. The
* discardedMap for this listener contains (locator,groups)
* pairs that correspond to lookup services that actually have
* been previously DISCARDED for various reasons (no longer
* interested in that lookup's locator, groups have changed,
* announcements have stopped, etc.).
*
* For any (locator,groups) pair from the discardedMap,
* the corresponding lookup service can change from not
* being of interest to now being of interest. This occurs
* when one of both of the following conditions occur:
* - the lookup's corresponding locator is NOW referenced in
* the locatorsToDiscover parameter (so there is new
* interest in discovering that lookup service using
* locator discovery)
* - the lookup's current member groups consist of AT LEAST
* ONE of the groups referenced in the groupsToDiscover
* parameter (so there is new interest in discovering
* that lookup service using group discovery)
*
* Note that renewed interest in using group discovery to
* discover the lookup service can occur when one or both of
* the following conditions occurs:
* - the lookup's current member groups has changed
* - the contents of the groupsToDiscover parameter has
* changed
*
* When a combination of conditions - as described above -
* indicate that a previously discarded lookup service
* (corresponding to an element of the discardedMap) is
* now of interest through either locator discovery or group
* discovery (or both), the lookup service will eventually be
* re-discovered. Thus, the corresponding (locator,groups)
* pair should be REMOVED from the expectedDiscardedMap, and
* a pair having that lookup's corresponding locator and
* current member groups should be placed in the
* expectedDiscoveredMap.
*
* Thus, for our purposes here, there are three conditions
* that must be met for the status of the lookup service to
* change from 'not of interest' to 'now of interest':
* -- the element of discardedMap, corresponding to the
* lookup service in question, must correspond to an
* element of the input ArrayList
* -- the locator of the lookup service in question must
* equal one of the elements of the locatorsToDiscover
* parameter
* -- at least ONE of the current member groups of the lookup
* service in question must equal one of the elements
* of the groupsToDiscover parameter
*/
eSet = discardedMap.entrySet();
iter = eSet.iterator();
while(iter.hasNext()) {
Map.Entry pair = (Map.Entry)iter.next();
LookupLocator loc = (LookupLocator)pair.getKey();
/* We care what the current member groups are now, as
* indicated by the contents of the input ArrayList;
* not the member groups that were originally discarded.
* If the groups of a previously discarded lookup, and/or
* the groupsToDiscover have changed in such a way that