Package net.jini.core.discovery

Examples of net.jini.core.discovery.LookupLocator


     *          of the given registrar.
     */
    protected boolean discoverByLocAnyReg(ServiceRegistrar lookupProxy)
                                                         throws RemoteException
    {
        LookupLocator loc = QAConfig.getConstrainedLocator(lookupProxy.getLocator());
        /* If at least one of the registrations in the registrationMap is
         * configured to discover the given lookup service by locator, then
         * return true; otherwise return false.
         */
  Iterator iter = registrationMap.values().iterator();
View Full Code Here


            synchronized(lockObject) {
                Iterator iter = genMap.keySet().iterator();
                while(iter.hasNext()) {
                    Object curGen = iter.next();
                    ServiceRegistrar srvcReg = null;
                    LookupLocator srvcRegLoc = null;
                    /* retrieve the locator and member groups of cur lookup */
                    if( curGen instanceof DiscoveryProtocolSimulator ) {
                        DiscoveryProtocolSimulator generator
                                         = (DiscoveryProtocolSimulator)curGen;
                        srvcReg = generator.getLookupProxy();
View Full Code Here

                    }//endif
                }//end loop(j)
            }//end loop(i)
            if(!inSet) {//no groups, try loc
                try {
                    LookupLocator srvcRegLoc = QAConfig.getConstrainedLocator(srvcReg.getLocator());
                    for(int i=0;i<locatorsToDiscover.length;i++) {
                        if( locsEqual(srvcRegLoc,locatorsToDiscover[i]) ) {
                            inSet = true;
                            break;
                        }//endif
View Full Code Here

            synchronized(lockObject) {
                Iterator iter = genMap.keySet().iterator();
                for(int i=0;iter.hasNext();i++) {
                    Object curGen = iter.next();
                    ServiceRegistrar lookupProxy = null;
                    LookupLocator genLoc = null;
                    if( curGen instanceof DiscoveryProtocolSimulator ) {
                        DiscoveryProtocolSimulator generator
                                         = (DiscoveryProtocolSimulator)curGen;
                        lookupProxy = generator.getLookupProxy();
                        genLoc = generator.getLookupLocator();
View Full Code Here

            for(int i=nLookupServices;i<totalNLookups;i++) {
                long waitMS = ( i < n ? waitTimes[i-1] : waitTimes[n-1] );
                logger.log(Level.FINE, "waiting "+(waitMS/1000)+" seconds before "
                              +"attempting to start the next lookup service");
                try {Thread.sleep(waitMS);} catch(InterruptedException e) { }
    LookupLocator l = (LookupLocator) lookupsToStart.get(i);
                int port =
        ((lookupsToStart.size() == totalNLookups ) ? l.getPort()
                                                   : 0);
                try {
                    startLookup(i, port, l.getHost());
                } catch(Exception e) {
                    e.printStackTrace();
                }
            }//end loop
        }//end run
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

        }
        maybeAddNewRegistrar(resp);
    } else if(req instanceof LookupLocator) {
        // Perform unicast discovery using the LookupLocator
        // host and port.
        LookupLocator loc = (LookupLocator)req;
        UnicastResponse resp = new MultiIPDiscovery() {
      protected UnicastResponse performDiscovery(
              Discovery disco,
              DiscoveryConstraints dc,
              Socket s)
          throws IOException, ClassNotFoundException
      {
          return doUnicastDiscovery(s, dc, disco);
      }
      protected void singleResponseException(Exception e,
                     InetAddress addr,
                     int port)
      {
          logger.log(
        Levels.HANDLED,
        "Exception occured during unicast discovery " +
        addr + ":" + port, e);
      }
        }.getResponse(loc.getHost(),
              loc.getPort(),
              rawUnicastDiscoveryConstraints);
        maybeAddNewRegistrar(resp);
    } else if(req instanceof CheckGroupsMarker) {
        // handle group changes
        announcement = ((CheckGroupsMarker)req).announcement;
        ServiceID srvcID = announcement.getServiceID();
        UnicastResponse resp = null;
        synchronized (registrars) {
      resp = (UnicastResponse)registrars.get(srvcID);
        }
        if(resp != null) {
      maybeSendEvent(resp, announcement.getGroups());
        }//endif
    } else if(req instanceof CheckReachabilityMarker) {
        // test reachability
        response = ((CheckReachabilityMarker)req).response;
        maybeSendEvent(response, null);
    }//endif
      } catch (InterruptedIOException e) {
    logger.log(Levels.HANDLED,
         "exception occurred during unicast discovery",
         e);
      } catch (Throwable e) {
    if (((req instanceof Socket) ||
        (req instanceof LookupLocator)) &&
        logger.isLoggable(Level.INFO)) {
        String logmsg =
      "exception occurred during unicast discovery to " +
      "{0}:{1,number,#} with constraints {2}";
        String methodName = "run";
        if (req instanceof Socket) {
      Socket sock = (Socket) req;
      LogUtil.logThrow(logger,
           Level.INFO,
           this.getClass(),
           methodName,
           logmsg,
           new Object[] {
              sock.getInetAddress().getHostName(),
              new Integer(sock.getPort()),
              rawUnicastDiscoveryConstraints
           },
           e);
        } else {
      LookupLocator loc = (LookupLocator) req;
      LogUtil.logThrow(logger,
           Level.INFO,
           this.getClass(),
           methodName,
           logmsg,
           new Object[] {
              loc.getHost(),
              new Integer(loc.getPort()),
              rawUnicastDiscoveryConstraints
           },
           e);
        }
    } else {
View Full Code Here

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

            for(int j=0;j<nLookups;j++) {
                RegInfo regInfo = new RegInfo();
                int jndx = (lusList.size()-1) - j;
                ServiceRegistrar lookupProxy =
                                        (ServiceRegistrar)lusList.get(jndx);
                LookupLocator loc = null;
                try {
                    loc = QAConfig.getConstrainedLocator(lookupProxy.getLocator());
                } catch(Exception e) {
                    e.printStackTrace();
                    throw new RuntimeException(e.toString());
View Full Code Here

                    Entry[] srvcAttrs = regInfo.srvcAttrs;
                    logger.log(Level.FINE, " service ID    = "+regInfo.srvcID);
                    logger.log(Level.FINE, " service Reg   = "+srvcReg);
                    logger.log(Level.FINE,
             " service Lease = " +regInfo.srvcLease);
        LookupLocator loc = regInfo.lookupProxy.getLocator();
        loc = QAConfig.getConstrainedLocator(loc);
        logger.log(Level.FINE,
             "  modifying attributes in lookup service -- "
             +loc);
        changeAttributes(srvcReg,oldAttrs,chngAttr);
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.