Examples of UnicastResponse


Examples of com.sun.jini.discovery.UnicastResponse

    defaultLoader,
    verifyCodebaseIntegrity,
    verifierLoader,
    context);

      return new UnicastResponse(host, port, groups, reg);

  } catch (RuntimeException e) {
      throw new DiscoveryProtocolException(null, e);
  }
    }
View Full Code Here

Examples of com.sun.jini.discovery.UnicastResponse

    }

    private ServiceRegistrar getRegistrar(InvocationConstraints constraints)
  throws IOException, ClassNotFoundException
    {
  UnicastResponse resp = new MultiIPDiscovery() {     
      protected UnicastResponse performDiscovery(Discovery disco,
        DiscoveryConstraints dc,
        Socket s)
    throws IOException, ClassNotFoundException
      {
    return disco.doUnicastDiscovery(
        s, dc.getUnfulfilledConstraints(), null, null, null);
      }
  }.getResponse(host, port, constraints);
  return resp.getRegistrar();
    }
View Full Code Here

Examples of com.sun.jini.discovery.UnicastResponse

  */
        private void doUnicastDiscovery(LookupLocator locator,
          InvocationConstraints ic)
      throws IOException, ClassNotFoundException
        {
      UnicastResponse resp = new MultiIPDiscovery() {
    protected UnicastResponse performDiscovery(
              Discovery disco,
              DiscoveryConstraints dc,
              Socket s)
    throws IOException, ClassNotFoundException
    {
        return disco.doUnicastDiscovery(
              s,
              dc.getUnfulfilledConstraints(),
              null,
              null,
              null);
       
    }
   
    protected void socketCloseException(IOException e) {
       logger.log(Level.FINEST,
           "IOException on socket close upon "
           + "completion of unicast discovery",
           e)
    }
   
    protected void singleResponseException(Exception e,
                   InetAddress addr,
                   int port)
    {
        logger.log(
      Levels.HANDLED,
      "Exception occured during unicast discovery " +
      addr + ":" + port, e);
    }
   
      }.getResponse(locator.getHost(), locator.getPort(), ic);
           
      /* Proxy preparation */
      proxy = (ServiceRegistrar)registrarPreparer.prepareProxy
              (resp.getRegistrar());
      logger.log(Level.FINEST, "LookupLocatorDiscovery - prepared "
           +"lookup service proxy: {0}", proxy);
      memberGroups = resp.getGroups();
        }//end doUnicastDiscovery
View Full Code Here

Examples of com.sun.jini.discovery.UnicastResponse

        DEFAULT_SOCKET_TIMEOUT));

      int pv = new DataInputStream(socket.getInputStream()).readInt();
      unicastDiscoveryConstraints.checkProtocolVersion(pv);
      getDiscovery(pv).handleUnicastDiscovery(
    new UnicastResponse(lookupLocator.getHost(),
            lookupLocator.getPort(),
            memberGroups,
            lookupProxy),
    socket,
    unicastDiscoveryConstraints.getUnfulfilledConstraints(),
View Full Code Here

Examples of com.sun.jini.discovery.UnicastResponse

       * unicast discovery.
       */
      Object pending = null;
      ServiceID srvcID = ann.getServiceID();
      synchronized (registrars) {
    UnicastResponse resp =
        (UnicastResponse) registrars.get(srvcID);
    if (resp != null) {
        // already in discovered set, timestamp announcement
        AnnouncementInfo aInfo =
      (AnnouncementInfo) regInfo.get(srvcID);
        aInfo.tStamp = System.currentTimeMillis();
        long currNum = ann.getSequenceNumber();
        if ((newSeqNum(currNum, aInfo.seqNum)) &&
      (!groupSetsEqual(resp.getGroups(), ann.getGroups()))) {
      /* Check if the groups have changed. In the case of
       * split announcement messages, eventually, group difference
       * will be seen for the given sequence number. This
       * check ignores other differences, such as port numbers,
       * but for the purposes of LookupDiscovery, this is not
View Full Code Here

Examples of com.sun.jini.discovery.UnicastResponse

      }
        }
    }
    Socket sock = null;
    MulticastAnnouncement announcement = null;
    UnicastResponse response = null;
    if (req instanceof Socket) {
        // Perform unicast discovery on the connected socket.
        DiscoveryConstraints unicastDiscoveryConstraints =
      DiscoveryConstraints.process(
          rawUnicastDiscoveryConstraints);
        sock = (Socket)req;
        UnicastResponse resp;
        try {
      prepareSocket(sock, unicastDiscoveryConstraints);
      resp = doUnicastDiscovery(sock,
              unicastDiscoveryConstraints);
        } finally {
      try {
          sock.close();
      } catch (IOException e) { /* ignore */ }
        }
        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());
View Full Code Here

Examples of com.sun.jini.discovery.UnicastResponse

                            long deltaT = curTime - tStamp;
                            if(deltaT > timeThreshold) {
                                /* announcements stopped, queue reachability
                                 * test and potential discarded event
                                 */
                                UnicastResponse resp =
            (UnicastResponse)registrars.get(srvcID);
        Object req = new CheckReachabilityMarker(resp);
                                synchronized (pendingDiscoveries) {
                                    if(pendingDiscoveries.add(req)) {
                                        restoreContextAddTask(
View Full Code Here

Examples of com.sun.jini.discovery.UnicastResponse

         unicastDiscoveryConstraints.getUnicastSocketTimeout(
             DEFAULT_SOCKET_TIMEOUT));
      int pv = new DataInputStream(socket.getInputStream()).readInt();
      unicastDiscoveryConstraints.checkProtocolVersion(pv);
      getDiscovery(pv).handleUnicastDiscovery(
    new UnicastResponse(myLocator.getHost(),
            myLocator.getPort(),
            memberGroups,
            proxy),
    socket,
    unicastDiscoveryConstraints.getUnfulfilledConstraints(),
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.