Package net.jini.lookup

Examples of net.jini.lookup.ServiceDiscoveryManager$LookupCacheImpl$LookupListener


            }
        }

        getConfiguration(configFileName);

        ServiceDiscoveryManager clientMgr = null;

        System.setSecurityManager(new RMISecurityManager());

        try {
            LookupDiscoveryManager mgr = new LookupDiscoveryManager(groups,
                    unicastLocators, // unicast locators
                    this); // DiscoveryListener
            clientMgr = new ServiceDiscoveryManager(mgr,
                    new LeaseRenewalManager());
        } catch (Exception ex) {
            throw new RuntimeException("Failed to initialize "
                    + "ClientServerInteractionManager using \""
                    + configFileName + "\"", ex);
        }

        // This is the class of the service we are looking for...
        Class[] classes = new Class[] { DistributedActor.class };
        ServiceTemplate template = new ServiceTemplate(null, classes, null);

        try {
            cache = clientMgr.createLookupCache(template, null, // no filter
                    this); // no listener
        } catch (Exception e) {
            KernelException.stackTraceToString(e);
        }
View Full Code Here


        try {

            final LookupDiscoveryManager discoverMgr = new LookupDiscoveryManager(
                lookupGroups, unicastLocaters, null);

            clientMgr = new ServiceDiscoveryManager(discoverMgr, new LeaseRenewalManager());
        } catch (IOException e) {
            final String message = "Error starting discovery";
            LOG.debug(message, e);
            throw new RuntimeException(message, e);
        }
View Full Code Here

        terminateDelay = 0;
        super.setup(config);
        testDesc = "service discovery manager with default lookup "
                   +"discovery manager (should discover public lookups)";
        srvcDiscoveryMgr =
      new ServiceDiscoveryManager(null,
          null,
          config.getConfiguration());
        sdmList.add(srvcDiscoveryMgr);
    }//end setup
View Full Code Here

  mainListener = new LookupListener();
  mainListener.setLookupsToDiscover(initLookupsToStart);
  if(createSDMInSetup) {
      /* Construct the ServiceDiscoveryManager that will be tested */
      logger.log(Level.FINE, "constructing a service discovery manager");
      srvcDiscoveryMgr = new ServiceDiscoveryManager
    (getLookupDiscoveryManager(),
     null,  //LeaseRenewalManager
     sysConfig.getConfiguration());
      sdmList.add(srvcDiscoveryMgr);
  }//endif
View Full Code Here

        try {
           /* Terminate each service discovery manager and each discovery
            * manager created during the test run.
            */
            for(int i=0;i<sdmList.size();i++) {
                ServiceDiscoveryManager sdmMgr
                                    = (ServiceDiscoveryManager)sdmList.get(i);
                DiscoveryManagement discMgr = sdmMgr.getDiscoveryManager();
                try {
                    logger.log(Level.FINE,
       "tearDown - terminating service discovery manager "+i);
                    sdmMgr.terminate();
                } catch(Exception e) {
                    e.printStackTrace();
                }
                try {
                    logger.log(Level.FINE,
View Full Code Here

      new LookupDiscoveryManager(DiscoveryGroupManagement.NO_GROUPS,
               null,
               null,
               sysConfig.getConfiguration());
        srvcDiscoveryMgr =
      new ServiceDiscoveryManager(discoveryMgr,
          null,
          sysConfig.getConfiguration());
        sdmList.add(srvcDiscoveryMgr);
    }//end setup
View Full Code Here

        int nAttrs   = 0;
        registerServices(startVal, nSrvcs, nAttrs, testServiceType);

        /* 2. Create half the SDM's and caches */
        for (int i=0; i<(N_SDM/2); i++) {
            ServiceDiscoveryManager sdm = new ServiceDiscoveryManager
                                      (ldm,null,testConfig.getConfiguration());
            sdmList.add(sdm);
            SDMListener l = new SDMListener(testConfig, "SDM_"+i);
            sdmListeners.add(l);
            caches.add( sdm.createLookupCache(template, null, l) );
        }//end loop

        /* 3. Register the remaining services */
        startVal = nSrvcs;
        registerServices(startVal, nSrvcs, nAttrs, testServiceType);

        /* 4. Create the remaining SDM's and caches */
        for (int i=(N_SDM/2); i<N_SDM; i++) {
            ServiceDiscoveryManager sdm = new ServiceDiscoveryManager
                                      (ldm,null,testConfig.getConfiguration());
            sdmList.add(sdm);
            SDMListener l = new SDMListener(testConfig, "SDM_"+i);
            sdmListeners.add(l);
            caches.add( sdm.createLookupCache(template, null, l) );
        }//end loop

        /* 5. Allow serviceAdded and serviceRemoved event to arrive */
        int nSecsTotal = 0;
        int nSecsWait  = 5;
View Full Code Here

     * configuration and assuming that the appropriate subject is in effect.
     */
    static void mainAsSubject(Configuration config) throws Exception {

  /* Get the service discovery manager, for discovering other services */
  ServiceDiscoveryManager serviceDiscovery;
  try {
      serviceDiscovery = (ServiceDiscoveryManager) config.getEntry(
    "com.sun.jini.example.hello.Client", "serviceDiscovery",
    ServiceDiscoveryManager.class);
  } catch (NoSuchEntryException e) {
      /* Default to search in the public group */
      serviceDiscovery = new ServiceDiscoveryManager(
    new LookupDiscovery(new String[] { "" }, config),
    null, config);
  }

        /* Retrieve the server proxy preparer from the configuration */
  ProxyPreparer preparer = (ProxyPreparer) config.getEntry(
      "com.sun.jini.example.hello.Client",
      "preparer", ProxyPreparer.class, new BasicProxyPreparer());

        /* Create the filter to pass to the SDM for proxy preparation */
        ServiceItemFilter filter = new ProxyPreparerFilter(preparer);

  /* Look up the remote server (SDM performs proxy preparation) */
  ServiceItem serviceItem = serviceDiscovery.lookup(
      new ServiceTemplate(null, new Class[] { Hello.class }, null),
      filter, Long.MAX_VALUE);
  Hello server = (Hello) serviceItem.service;

  /* Use the server */
 
View Full Code Here

                                                       false);
            serviceDescriptor.create(starterConfig);
        }//end loop

        /* create SDM to retrieve ref to TestService-i from lookup */
        sdm = new ServiceDiscoveryManager
                                    (ldm, null, sysConfig.getConfiguration());
    }//end setup
View Full Code Here

        ServiceTemplate cybernodes = new ServiceTemplate(null, new Class[]{Cybernode.class}, null);
        ServiceTemplate eventCollectors = new ServiceTemplate(null,
                                                              new Class[]{EventCollector.class},
                                                              new Entry[]{new OperationalStringEntry(org.rioproject.config.Constants.CORE_OPSTRING)});

        sdm = new ServiceDiscoveryManager(jiniClient.getDiscoveryManager(), new LeaseRenewalManager(), config);

        ServiceWatcher watcher = new ServiceWatcher();

        ProvisionClientEventConsumer provisionClientEventConsumer = new ProvisionClientEventConsumer();
View Full Code Here

TOP

Related Classes of net.jini.lookup.ServiceDiscoveryManager$LookupCacheImpl$LookupListener

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.