Package net.jini.lookup

Examples of net.jini.lookup.ServiceDiscoveryManager


            //testManager.startProvisionMonitor();
            int cybernodeCount = Math.max(testManager.getHostList().size(), 2);
            for (int i = 0; i < cybernodeCount; i++) {
                testManager.startCybernode(i);
            }
            ServiceDiscoveryManager sdm = testManager.getServiceDiscoveryManager();
            cyberMon = new ServiceMonitor<Cybernode>(sdm, Cybernode.class);
            cyberMon.waitFor(cybernodeCount);
        }
    }
View Full Code Here


        }
    }

    @Test
    public void runTest() throws Exception {
        ServiceDiscoveryManager sdm = testManager.getServiceDiscoveryManager();
        ServiceMonitor<ProvisionMonitor> pmMon = new ServiceMonitor<ProvisionMonitor>(sdm, ProvisionMonitor.class);
        pmMon.waitFor(1);
        ProvisionMonitor monitor = pmMon.getServices().get(0);

        final boolean[] fixedValues = new boolean[] {false, true};
View Full Code Here

    public void initialize(final EventCollectorContext context) throws Exception {
        if(context==null)
            throw new IllegalArgumentException("context must not be null");
        this.eventQ = context.getEventQueue();
        ServiceDiscoveryManager sdm = new ServiceDiscoveryManager(context.getDiscoveryManager(),
                                                                  new LeaseRenewalManager(context.getConfiguration()),
                                                                  context.getConfiguration());
        for(EventDescriptor eventDescriptor : context.getEventDescriptors()) {
            ServiceTemplate template = new ServiceTemplate(null, null, new Entry[]{eventDescriptor});
            LookupCache lCache = sdm.createLookupCache(template, null,  null);
            EventProducerManager eventProducerManager = new EventProducerManager(eventDescriptor, this, lCache);
            lCache.addListener(eventProducerManager);
            eventProducerManagers.add(eventProducerManager);
        }
View Full Code Here

                                final DiscoveryManagement dMgr,
                                final Configuration config) throws Exception {
        super(edTemplate, listener, handback, config);
        ServiceTemplate template = new ServiceTemplate(null, null, new Entry[]{edTemplate});
        Configuration configInstance = config==null?EmptyConfiguration.INSTANCE:config;
        sdm = new ServiceDiscoveryManager(dMgr, new LeaseRenewalManager(configInstance), configInstance);
        lCache = sdm.createLookupCache(template, null,  null);
        lCache.addListener(new EventProducerManager());
    }
View Full Code Here

        LookupDiscoveryManager ldm =
                new LookupDiscoveryManager(LookupDiscoveryManager.ALL_GROUPS,
                                           null,
                                           null);
        System.out.println("Discovering Hello service ...");
        ServiceDiscoveryManager sdm =
                new ServiceDiscoveryManager(ldm, new LeaseRenewalManager());
        /* Wait no more then 10 seconds to discover the service */
        ServiceItem item = sdm.lookup(tmpl, null, 10000);
        if(item != null) {
            System.out.println("Discovered Hello service");
            Hello hello = (Hello)item.service;
            System.out.println("Invoking Hello service ...");
            String ret = hello.hello("Hello from Client");
            System.out.println("Received: "+ret+" from Hello service");
        } else {
            System.out.println("Hello service not discovered, make sure "+
                               "service is deployed");
        }
        sdm.terminate();
    }
View Full Code Here

TOP

Related Classes of net.jini.lookup.ServiceDiscoveryManager

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.