Package net.jini.core.discovery

Examples of net.jini.core.discovery.LookupLocator


        }//end sync
    }//end getUnicastPort

    public void setUnicastPort(int port) throws IOException {
  if (port == unicastPort) return;
        LookupLocator tmpLocator = null;
        synchronized(lockLookupLocator) {
            if(    (    (port == 0)
                     && (unicastRequestThread.port == Constants.discoveryPort))
                || (port == unicastRequestThread.port) )
            {
View Full Code Here


      } catch (InterruptedException e) { }
      /* start the UnicastThread listening on the new port */
      unicaster = newUnicaster;
      unicaster.start();
      unicastPort = port;
      myLocator = new LookupLocator(myLocator.getHost(), unicaster.port);
      synchronized (announcer) {
    announcer.notify();
      }
      addLogRecord(new UnicastPortSetLogObj(port));
  } finally {
View Full Code Here

  resolver.setInRecovery(false);
  inRecovery = false;
  computeMaxLeases();
        nicAddresses = getNICAddresses();
  unicaster = new UnicastThread(unicastPort);
  myLocator = new LookupLocator(host, unicaster.port);
  multicaster = new MulticastThread();
  announcer = new AnnounceThread();
  if (myServiceID == null)
      myServiceID = newServiceID();
  proxy = new RegistrarProxy((Registrar)RemoteObject.toStub(this),
View Full Code Here

                Set dSet = discoveredMap.keySet();
                Set eSet = expectedDiscoveredMap.keySet();
                ArrayList uLocsList = new ArrayList(eSet.size());
                Iterator iter = eSet.iterator();
                while(iter.hasNext()) {
                    LookupLocator loc = (LookupLocator)iter.next();
                    if( !dSet.contains(loc) ) uLocsList.add(loc);
                }//end loop
                return ((LookupLocator[])(uLocsList).toArray
                                       (new LookupLocator[uLocsList.size()]));
            }//end sync(this)
View Full Code Here

                 * 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
View Full Code Here

                synchronized(this) {
                    boolean oneDiscovered = false;
                    ArrayList lusList = getLookupListSnapshot
                                     ("BaseQATest$LookupListenter.discovered");
                    for(int i=0;i<regs.length;i++) {
                        LookupLocator loc = null;
                        String[] groups = null;
                        boolean lookupOK = false;
                        if( lusList.contains(regs[i]) ) {
                            logger.log(Level.FINE,
                                        "     regs["+i+"] is in lookupList");
View Full Code Here

                         * was started.
                         */
                        LocatorGroupsPair pair =
                            (LocatorGroupsPair)regsToLocGroupsMap.get(regs[i]);
                        if(pair == null) continue;//lookup started outside test
                        LookupLocator loc = pair.locator;
                        /* Add to discardedMap only if previously discovered */
                        if((loc != null)&&(discoveredMap.remove(loc) != null)){
                            logger.log(Level.FINE,
                                              "   discarded locator = "+loc);
                            String[] groups = (String[])groupsMap.get(regs[i]);
View Full Code Here

                 */
                Set eSet = discoveredMap.entrySet();
          Iterator iter = eSet.iterator();
                while(iter.hasNext()) {
                    Map.Entry pair = (Map.Entry)iter.next();
                    LookupLocator loc = (LookupLocator)pair.getKey();
                    String[] oldGroups = (String[])pair.getValue();

                    if( !isElementOf(loc,locators) ) continue;
                    String[] newGroups = getGroups(loc,locGroupsList);
                    if(newGroups == null) {
View Full Code Here

                            logger.log(Level.FINE,
                                  "     regs["+i+"] is NOT in lookupList");
                            continue;//care only about lookups the test started
                        }//endif
                        try {
                            LookupLocator loc = QAConfig.getConstrainedLocator(regs[i].getLocator());
                            String[] groups = (String[])groupsMap.get(regs[i]);
                            changedMap.put(loc,groups);
                            discoveredMap.put(loc,groups);//replace old loc
                            discardedMap.remove(loc);
                            LocatorsUtil.displayLocator(loc,
View Full Code Here

       */     
      pending = new CheckGroupsMarker(ann);
        }
    } else if (groupsOverlap(ann.getGroups())) {
        // newly discovered
        pending = new LookupLocator(ann.getHost(), ann.getPort());
    }
      }
      if (pending != null) {
    try {
        checkAnnouncementConstraints(ann);
View Full Code Here

TOP

Related Classes of net.jini.core.discovery.LookupLocator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.