Package net.jini.discovery

Examples of net.jini.discovery.LookupDiscoveryRegistration


        RegistrationInfo regInfo = new RegistrationInfo(groupsToDiscover,
                                                        locatorsToDiscover,
                                                        iHandback);
        LDSEventListener listener =
                               new AbstractBaseTest.LDSEventListener(regInfo);
        LookupDiscoveryRegistration ldsReg = null;
  try {
      ldsReg = discoverySrvc.register(groupsToDiscover,
              locatorsToDiscover,
              listener,
              mHandback,
View Full Code Here


     */
    protected void addGroupsOneReg(String[]  groups,
                                   Map.Entry regListenerPair)
                                                       throws RemoteException
    {
        LookupDiscoveryRegistration reg
                 = (LookupDiscoveryRegistration)regListenerPair.getKey();
        RegistrationInfo regInfo 
                 = ((LDSEventListener)regListenerPair.getValue()).getRegInfo();
        String[] groupsToDiscover = groups;
        if(   (regInfo.groupsToDiscover != DiscoveryGroupManagement.ALL_GROUPS)
            &&(groups != DiscoveryGroupManagement.ALL_GROUPS) )
       {
            int curLen = (regInfo.groupsToDiscover).length;
            int newLen = groups.length;
            groupsToDiscover = new String[curLen + newLen];
            for(int i=0;i<curLen;i++) {
                groupsToDiscover[i] = new String(regInfo.groupsToDiscover[i]);
            }//end loop
            for(int i=curLen;i<(curLen+newLen);i++) {
                groupsToDiscover[i] = new String(groups[i-curLen]);
            }//end loop
            synchronized(regInfo) {
                /* update the expected state for this regInfo information */
                regInfo.setLookupsToDiscover(groupsToDiscover,
                                             new LookupLocator[0]);
            }//end sync(regInfo)
        }//endif
        /* Add to the groups the lds should discover for this registration */
        reg.addGroups(groups);
    }//end addGroupsOneReg
View Full Code Here

     */
    protected void setGroupsOneReg(String[]  groups,
                                   Map.Entry regListenerPair)
                                                       throws RemoteException
    {
        LookupDiscoveryRegistration reg
                 = (LookupDiscoveryRegistration)regListenerPair.getKey();
        RegistrationInfo regInfo 
                 = ((LDSEventListener)regListenerPair.getValue()).getRegInfo();
        synchronized(regInfo) {
            /* update the expected state for this regInfo information */
            regInfo.setLookupsToDiscover(groups,new LookupLocator[0]);
        }//end sync(regInfo)
        /* Change the groups the lds should discover for this registration */
        reg.setGroups(groups);
    }//end setGroupsOneReg
View Full Code Here

     */
    protected void removeGroupsOneReg(String[]  groups,
                                      Map.Entry regListenerPair)
                                                       throws RemoteException
    {
        LookupDiscoveryRegistration reg
                 = (LookupDiscoveryRegistration)regListenerPair.getKey();
        RegistrationInfo regInfo 
                 = ((LDSEventListener)regListenerPair.getValue()).getRegInfo();

        String[] curGroupsToDiscover = regInfo.groupsToDiscover;
        String[] groupsToRemove = groups;
        String[] newGroupsToDiscover = DiscoveryGroupManagement.NO_GROUPS;

        if(    (curGroupsToDiscover != DiscoveryGroupManagement.ALL_GROUPS)
            && (groupsToRemove      != DiscoveryGroupManagement.ALL_GROUPS) )
        {
            int curLen = curGroupsToDiscover.length;
            int remLen = groupsToRemove.length;
            ArrayList newList = new ArrayList(curLen+remLen);
            iLoop:
            for(int i=0;i<curLen;i++) {
                for(int j=0;j<remLen;j++) {
                    if(curGroupsToDiscover[i].equals(groupsToRemove[j])) {
                        continue iLoop;
                    }//endif
                }//endloop(j)
                newList.add(curGroupsToDiscover[i]);
            }//end loop(i)
            newGroupsToDiscover
                   = (String[])(newList.toArray(new String[newList.size()]));
            synchronized(regInfo) {
                /* update the expected state for this regInfo information */
                regInfo.setLookupsToDiscover(newGroupsToDiscover,
                                             new LookupLocator[0]);
            }//end sync(regInfo)
        }//endif
        /* remove the groups the lds should discover from this registration */
        reg.removeGroups(groups);
    }//end removeGroupsOneReg
View Full Code Here

     */
    protected void addLocatorsOneReg(LookupLocator[] locators,
                                     Map.Entry       regListenerPair)
                                                       throws RemoteException
    {
        LookupDiscoveryRegistration reg
                 = (LookupDiscoveryRegistration)regListenerPair.getKey();
        RegistrationInfo regInfo 
                 = ((LDSEventListener)regListenerPair.getValue()).getRegInfo();
        LookupLocator[] locatorsToDiscover = locators;

        if(locators != null) {
            int curLen = (regInfo.locatorsToDiscover).length;
            int newLen = locators.length;
            locatorsToDiscover = new LookupLocator[curLen + newLen];
            for(int i=0;i<curLen;i++) {
                locatorsToDiscover[i] = regInfo.locatorsToDiscover[i];
            }//end loop
            for(int i=curLen;i<(curLen+newLen);i++) {
                locatorsToDiscover[i] = locators[i-curLen];
            }//end loop
        }//endif
        synchronized(regInfo) {
            /* update the expected state for this regInfo information */
            regInfo.setLookupsToDiscover(DiscoveryGroupManagement.NO_GROUPS,
                                         locatorsToDiscover);
        }//end sync(regInfo)
        /* Add to the locators the lds should discover for this registration */
        reg.addLocators(locators);
    }//end addLocatorsOneReg
View Full Code Here

     */
    protected void setLocatorsOneReg(LookupLocator[]  locators,
                                     Map.Entry regListenerPair)
                                                       throws RemoteException
    {
        LookupDiscoveryRegistration reg
                 = (LookupDiscoveryRegistration)regListenerPair.getKey();
        RegistrationInfo regInfo 
                 = ((LDSEventListener)regListenerPair.getValue()).getRegInfo();
        synchronized(regInfo) {
            /* update the expected state for this regInfo information */
            regInfo.setLookupsToDiscover(DiscoveryGroupManagement.NO_GROUPS,
                                         locators);
        }//end sync(regInfo)
        /* Change the locators the lds should discover for this registration */
        reg.setLocators(locators);
    }//end setLocatorsOneReg
View Full Code Here

     */
    protected void removeLocatorsOneReg(LookupLocator[]  locators,
                                        Map.Entry regListenerPair)
                                                       throws RemoteException
    {
        LookupDiscoveryRegistration reg
                 = (LookupDiscoveryRegistration)regListenerPair.getKey();
        RegistrationInfo regInfo 
                 = ((LDSEventListener)regListenerPair.getValue()).getRegInfo();

        LookupLocator[] curLocatorsToDiscover = regInfo.locatorsToDiscover;
        LookupLocator[] locatorsToRemove = locators;
        LookupLocator[] newLocatorsToDiscover = new LookupLocator[0];

        if( (curLocatorsToDiscover != null) && (locatorsToRemove != null) ) {
            int curLen = curLocatorsToDiscover.length;
            int remLen = locatorsToRemove.length;
            ArrayList newList = new ArrayList(curLen+remLen);
            iLoop:
            for(int i=0;i<curLen;i++) {
                for(int j=0;j<remLen;j++) {
                    if( locsEqual
                             (curLocatorsToDiscover[i],locatorsToRemove[j]) )
                    {
                        continue iLoop;
                    }//endif
                }//endloop(j)
                newList.add(curLocatorsToDiscover[i]);
            }//end loop(i)
            newLocatorsToDiscover = (LookupLocator[])(newList.toArray
                                         (new LookupLocator[newList.size()]));
            synchronized(regInfo) {
                /* update the expected state for this regInfo information */
                regInfo.setLookupsToDiscover
                                          (DiscoveryGroupManagement.NO_GROUPS,
                                           newLocatorsToDiscover);
            }//end sync(regInfo)
        }//endif
        /* remove the locators the lds should discover for this registration */
        reg.removeLocators(locators);
    }//end removeLocatorsOneReg
View Full Code Here

        }//endif
        /* Prepare the locators associated with the requested registration
         * outside of the sync block because of possible remote call.
         */
        prepareNewLocators(locatorToDiscoverPreparer,locators);
        LookupDiscoveryRegistration reg = null;
        concurrentObj.writeLock();
        try {
            /*  Grant the registration request and add the registration to
             *  to this service's state.
             *
 
View Full Code Here

        Lease lease = null;
        long  actualDur = 0;
        /* Request a registration with the lookup discovery service */
        logger.log(Level.FINE, "registering with the lookup discovery service");
  ServiceEventListener eventListener = new ServiceEventListener();
  LookupDiscoveryRegistration reg =
      DiscoveryServiceUtil.getRegistration
                    (discoverySrvc,
         eventListener,
         memberGroups,
         duration,
View Full Code Here

    void setLocatorsDo(LookupLocator[] newLocators) throws Exception {
        Set eSet = regInfoMap.entrySet();
        Iterator iter = eSet.iterator();
        for(int j=0;iter.hasNext();j++) {
            Map.Entry pair = (Map.Entry)iter.next();
            LookupDiscoveryRegistration ldsReg =
                                    (LookupDiscoveryRegistration)pair.getKey();

            LDSEventListener regListener = (LDSEventListener)pair.getValue();
            RegistrationInfo regInfo = regListener.getRegInfo();
            int rID = regInfo.handback;
      logger.log(Level.FINE,
           "  registration_"+rID
           +" -- request discovery of new locators");
     
      if((newLocators != null)&&(newLocators.length <= 0)) {
    logger.log(Level.FINE, "   NO_LOCATORS");
      } else {
    LocatorsUtil.displayLocatorSet(newLocators,
                                               "   newLocator",Level.FINE);
      }//endif
      setExpectedDiscardedMap(regInfo);
      ldsReg.setLocators(newLocators);
        }//end loop(j)
    }//end setLocatorsDo
View Full Code Here

TOP

Related Classes of net.jini.discovery.LookupDiscoveryRegistration

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.