Examples of UnicastResponse


Examples of com.sun.jini.discovery.UnicastResponse

     *                   <code>reg</code> parameter
     */
    private void sendDiscarded(ServiceRegistrar reg, String[] curGroups) {
        ServiceID srvcID = reg.getServiceID();
        if(curGroups == null) { // discard request is from external source
            UnicastResponse resp = (UnicastResponse)registrars.get(srvcID);
            if(resp == null) return;
            curGroups = resp.getGroups();
        }//endif
        if( registrars.remove(srvcID) != null ) {
            regInfo.remove(srvcID);
            if( !listeners.isEmpty() ) {
                addNotify((ArrayList)listeners.clone(),
View Full Code Here

Examples of com.sun.jini.discovery.UnicastResponse

     *                   member groups of the registrar referenced by the
     *                   <code>reg</code> parameter
     */
    private void sendChanged(ServiceRegistrar reg, String[] curGroups) {
        /* replace old groups with new; prevents repeated changed events */
        UnicastResponse resp =
                   (UnicastResponse)registrars.get(reg.getServiceID());
  registrars.put(reg.getServiceID(),
           new UnicastResponse(resp.getHost(),
             resp.getPort(),
             curGroups,
             resp.getRegistrar()));
        if( !listeners.isEmpty() ) {
            addNotify((ArrayList)listeners.clone(),
                       mapRegToGroups(reg,curGroups), CHANGED);
        }//endif
    }//end sendChanged
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

         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

Examples of com.sun.jini.discovery.UnicastResponse

      listeners.add(l);
      if (registrars.isEmpty()) return;//nothing to send the new listener
            HashMap groupsMap = new HashMap(registrars.size());
      Iterator iter = registrars.values().iterator();
      while (iter.hasNext()) {
                UnicastResponse resp = (UnicastResponse)iter.next();
                groupsMap.put(resp.getRegistrar(),resp.getGroups());
      }
      ArrayList list = new ArrayList(1);
      list.add(l);
      addNotify(list, groupsMap, DISCOVERED);
  }
View Full Code Here

Examples of com.sun.jini.discovery.UnicastResponse

                            return proxy;
                        }//end run
                    }),//end PrivilegedExceptionAction and wrap
                  securityContext.getAccessControlContext());//end doPrivileged
      if (prepReg != srcReg) {
    resp = new UnicastResponse(resp.getHost(),
             resp.getPort(),
             resp.getGroups(),
             prepReg);
      }
  } catch (Exception e) {
View Full Code Here

Examples of com.sun.jini.discovery.UnicastResponse

     */
    private void maybeDiscardRegistrars() {
  synchronized (registrars) {
            HashMap groupsMap = new HashMap(registrars.size());
      for(Iterator iter=registrars.values().iterator();iter.hasNext(); ){
    UnicastResponse ent = (UnicastResponse)iter.next();
    if(!groupsOverlap(ent.getGroups())) { // not interested anymore
                    groupsMap.put(ent.getRegistrar(),ent.getGroups());
                    regInfo.remove(ent.getRegistrar().getServiceID());
        iter.remove(); // remove (srvcID,response) mapping
    }//endif
      }//end loop
            if( !groupsMap.isEmpty() && !listeners.isEmpty() ) {
    addNotify((ArrayList)listeners.clone(), groupsMap, DISCARDED);
View Full Code Here

Examples of com.sun.jini.discovery.UnicastResponse

        }//endif
 
  synchronized (registrars) {
      // Other events may have occured to registrars while we were
      // making our remote call.
      UnicastResponse resp =
    (UnicastResponse) registrars.get(reg.getServiceID());
      if (resp == null) {
    // The registrar was discarded in the meantime. Oh well.
    return;
      }
      notifyOnGroupChange(reg, resp.getGroups(), actualGroups);
  }
    }//end maybeSendEvent
View Full Code Here

Examples of com.sun.jini.discovery.UnicastResponse

     *                   <code>reg</code> parameter
     */
    private void sendDiscarded(ServiceRegistrar reg, String[] curGroups) {
        ServiceID srvcID = reg.getServiceID();
        if(curGroups == null) { // discard request is from external source
            UnicastResponse resp = (UnicastResponse)registrars.get(srvcID);
            if(resp == null) return;
            curGroups = resp.getGroups();
        }//endif
        if( registrars.remove(srvcID) != null ) {
            regInfo.remove(srvcID);
            if( !listeners.isEmpty() ) {
                addNotify((ArrayList)listeners.clone(),
View Full Code Here

Examples of com.sun.jini.discovery.UnicastResponse

     *                   member groups of the registrar referenced by the
     *                   <code>reg</code> parameter
     */
    private void sendChanged(ServiceRegistrar reg, String[] curGroups) {
        /* replace old groups with new; prevents repeated changed events */
        UnicastResponse resp =
                   (UnicastResponse)registrars.get(reg.getServiceID());
  registrars.put(reg.getServiceID(),
           new UnicastResponse(resp.getHost(),
             resp.getPort(),
             curGroups,
             resp.getRegistrar()));
        if( !listeners.isEmpty() ) {
            addNotify((ArrayList)listeners.clone(),
                       mapRegToGroups(reg,curGroups), CHANGED);
        }//endif
    }//end sendChanged
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.