Package net.jini.core.lookup

Examples of net.jini.core.lookup.ServiceRegistrar


        Iterator iter = genMap.keySet().iterator();
        for(int i=0;iter.hasNext();i++) {
            DiscoveryProtocolSimulator curGen =
                                       (DiscoveryProtocolSimulator)iter.next();
            String[]         curGroups   = curGen.getMemberGroups();
            ServiceRegistrar lookupProxy = curGen.getLookupProxy();
            if( locatorsMap.containsKey(lookupProxy) ) {
                locatorsList.add(QAConfig.getConstrainedLocator("newHost",(portBase+i)));
                proxiesReplaced.add(lookupProxy);
            } else {
                locatorsList.add( curGen.getLookupLocator() );// no change here
View Full Code Here


                              ( getLocatorListToUseByIndex(regInfo.handback) );
        Map expectedMap = getExpectedDiscardedMap(regInfo,discardType);
        Set kSet = expectedMap.keySet();
        Iterator iter = kSet.iterator();
        for(int j=0;iter.hasNext();j++) {
            ServiceRegistrar lookupProxy = (ServiceRegistrar)iter.next();
            if(    !locMap.containsKey(lookupProxy)
                || !proxiesReplaced.contains(lookupProxy)
                || ((regInfo.locatorsToDiscover).length == 0) )
            {
                iter.remove();
View Full Code Here

        Iterator iter = genMap.keySet().iterator();
        for(int i=0;iter.hasNext();i++) {
            logger.log(Level.FINE, "stop multicast announcements "
                              +"from lookup service "+i+" ...");
            Object curObj = iter.next();
            ServiceRegistrar regProxy = null;
            /* Since LookupDiscovery sends a unicast announcement, at
             * startup, typically resulting in immediate discovery by
             * unicast, the generator won't send its first multicast
             * announcement until after net.jini.discovery.announce
             * number of milliseconds. Thus, before stopping multicast
View Full Code Here

        Iterator iter = genMap.keySet().iterator();
        for(int i=0;iter.hasNext();i++) {
            DiscoveryProtocolSimulator curGen =
                                       (DiscoveryProtocolSimulator)iter.next();
            String[]         curGroups   = curGen.getMemberGroups();
            ServiceRegistrar lookupProxy = curGen.getLookupProxy();
            if(  ((i%2) == 0) && (locatorsMap.containsKey(lookupProxy)) ) {
                locatorsList.add( curGen.getLookupLocator() );
                proxiesRemoved.add(lookupProxy);
      }//endif
        }//end loop
View Full Code Here

                              ( getLocatorListToUseByIndex(regInfo.handback) );
        Map expectedMap = getExpectedDiscardedMap(regInfo,discardType);
        Set kSet = expectedMap.keySet();
        Iterator iter = kSet.iterator();
        for(int j=0;iter.hasNext();j++) {
            ServiceRegistrar lookupProxy = (ServiceRegistrar)iter.next();
            if(    !locMap.containsKey(lookupProxy)
                || !proxiesRemoved.contains(lookupProxy)
                || ((regInfo.locatorsToDiscover).length == 0) )
            {
                iter.remove();
View Full Code Here

                 */
                Set eSet = discoveredMap.entrySet();
          Iterator iter = eSet.iterator();
                while(iter.hasNext()) {
                    Map.Entry pair = (Map.Entry)iter.next();
                    ServiceRegistrar srvcReg = (ServiceRegistrar)pair.getKey();
                    String[] srvcRegGroups   = (String[])pair.getValue();
                    boolean inSet = inToDiscoverSet(srvcReg,srvcRegGroups);
                    if( inToDiscoverSet(srvcReg,srvcRegGroups) ) continue;
                    expectedDiscoveredMap.remove(srvcReg);
                    expectedNoInterestDiscardedMap.put(srvcReg,srvcRegGroups);
                    expectedPassiveDiscardedMap.put(srvcReg,srvcRegGroups);
                }//end loop
                /* If one of the registrars that's already been DISCARDED
                 * belongs to any of the groups to discover and/or has a
                 * locator that's an element of the set of locators to
                 * discover, MOVE that registrar's corresponding element from
                 * the discardedMap into the expectedDiscoveredMap.
                 */
                eSet = discardedMap.entrySet();
          iter = eSet.iterator();
                while(iter.hasNext()) {
                    Map.Entry pair = (Map.Entry)iter.next();
                    ServiceRegistrar srvcReg = (ServiceRegistrar)pair.getKey();
                    String[] srvcRegGroups   = (String[])pair.getValue();
                    if( !inToDiscoverSet(srvcReg,srvcRegGroups) ) continue;
                    discardedMap.remove(srvcReg);
                    expectedNoInterestDiscardedMap.remove(srvcReg);
                    expectedPassiveDiscardedMap.remove(srvcReg);
                    expectedDiscoveredMap.put(srvcReg,srvcRegGroups);
                }//end loop
            }//end sync(this)
            /* If one of the groups or locs to discover corresponds to one
             * or more of the lookups that were started but have not yet
             * been discovered (that is, the group or loc to discover does not
             * correspond to any element of the discoveredMap), then add
             * those un-discovered lookups to the expectedDiscoveredMap.
             */
            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();
                        srvcRegLoc = generator.getLookupLocator();
                    } else {
                        srvcReg = (ServiceRegistrar)curGen;
                        try {
                            srvcRegLoc = QAConfig.getConstrainedLocator(srvcReg.getLocator());
                        } catch(RemoteException e) {
                            e.printStackTrace();
                            continue;
                        }
                    }//endif
View Full Code Here

        private void initState() {
            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();
                    } else {
                        lookupProxy = (ServiceRegistrar)curGen;
                        try {
                            genLoc = QAConfig.getConstrainedLocator(lookupProxy.getLocator());
                        } catch(RemoteException e) {
                            e.printStackTrace();
                        }
                    }//endif
                    String[] genGroups = (String[])genMap.get(curGen);
View Full Code Here

        try {
            final String serviceClassNames[] = substitute(serviceClasses);
            this.dbgSpecSrvcs(serviceClasses, serviceClassNames);

            if (useLookup) {
                ServiceRegistrar lookupProxy =
        manager.startLookupService(); // prepared by util
    // prepared by DiscoveryAdminUtil
                admin = DiscoveryAdminUtil.getDiscoveryAdmin(lookupProxy);
            }
View Full Code Here

    protected String startLookup(int indx, int port, String serviceHost) throws Exception {
        logger.log(Level.FINE, " starting lookup service "+indx);
        /* retrieve the member groups with which to configure the lookup */
        String[] memberGroups = (String[])memberGroupsList.get(indx);
        ServiceRegistrar lookupProxy = null;
  String simulatorName =
      "com.sun.jini.test.services.lookupsimulator.LookupSimulatorImpl";
        if(implClassname.equals(simulatorName)) {
            DiscoveryProtocolSimulator generator = null;
            if(debugsync) logger.log(Level.FINE,
                              "     BaseQATest.startLookup - "
                              +"sync on lookupList --> requested");
            synchronized(lookupList) {
                if(debugsync) logger.log(Level.FINE,
                                  "     BaseQATest.startLookup - "
                                  +"sync on lookupList --> granted");
                /* Use either a random or an explicit locator port */
                generator = new DiscoveryProtocolSimulator
                                               (config,memberGroups,manager, port);
                genMap.put( generator, memberGroups );
                lookupProxy = generator.getLookupProxy();
                lookupList.add( lookupProxy );
                if(debugsync) logger.log(Level.FINE,
                                  "     BaseQATest.startLookup - "
                                  +"  added new proxy to lookupList");
                if(debugsync) logger.log(Level.FINE,
                                  "     BaseQATest.startLookup - "
                                  +"sync on lookupList --> released");
            }//end sync(lookupList)
            /* Force non-unique groups for manual tests */
            if(    (testType == MANUAL_TEST_REMOTE_COMPONENT)
                || (testType == MANUAL_TEST_LOCAL_COMPONENT) )
            {
                generator.setMemberGroups(memberGroups);
            }//endif
        } else {//start a non-simulated lookup service implementation
            if(debugsync) logger.log(Level.FINE,
                              "     BaseQATest.startLookup - "
                              +"sync on lookupList --> requested");
            synchronized(lookupList) {
                if(debugsync) logger.log(Level.FINE,
                                  "     BaseQATest.startLookup - "
                                  +"sync on lookupList --> granted");
    /* returned proxy is already prepared */
                lookupProxy = manager.startLookupService(serviceHost);
                lookupList.add( lookupProxy );
                if(debugsync) logger.log(Level.FINE,
                                  "     BaseQATest.startLookup - "
                                  +"  added new proxy to lookupList");
                if(debugsync) logger.log(Level.FINE,
                                  "     BaseQATest.startLookup - "
                                  +"sync on lookupList --> released");
            }//end sync(lookupList)
            genMap.put( lookupProxy, memberGroups );
            /* Force non-unique groups for manual tests */
            if(    (testType == MANUAL_TEST_REMOTE_COMPONENT)
                || (testType == MANUAL_TEST_LOCAL_COMPONENT) )
            {
                if(lookupProxy instanceof Administrable) {
                    Object admin = ((Administrable)lookupProxy).getAdmin();
        admin = getConfig().prepare("test.reggieAdminPreparer",
            admin);
                    if(admin instanceof DiscoveryAdmin) {
                        ((DiscoveryAdmin)admin).setMemberGroups(memberGroups);
                    }
                }
            }
        }

        LookupLocator lookupLocator =
      QAConfig.getConstrainedLocator(lookupProxy.getLocator());
        LocatorGroupsPair locGroupsPair = new LocatorGroupsPair(lookupLocator,
                                                                memberGroups);
        try {
            lookupsStarted.add(indx,locGroupsPair);
        } catch(IndexOutOfBoundsException e) {
View Full Code Here

     */
    protected void terminateAllLookups() throws TestException {
        Iterator iter = genMap.keySet().iterator();
        for(int i=0;iter.hasNext();i++) {
            Object curObj = iter.next();
            ServiceRegistrar regProxy = null;
            if(curObj instanceof DiscoveryProtocolSimulator) {
                DiscoveryProtocolSimulator curGen
                                         = (DiscoveryProtocolSimulator)curObj;
                regProxy = curGen.getLookupProxy();
                curGen.stopAnnouncements();
View Full Code Here

TOP

Related Classes of net.jini.core.lookup.ServiceRegistrar

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.