Package net.jini.discovery

Examples of net.jini.discovery.LookupDiscovery


  /* Use LookupLocatorDiscovery to find a Lookup Service */
  if (_lookupSrvc == null) { // first time
      // Use LookupDiscovery to find a Lookup Service
      try {
    System.out.println("LookupDiscovery for " + _groupsToJoin[0]);
    _lookupDiscovery = new LookupDiscovery(_groupsToJoin);
      }
      catch (IOException e) {
    System.out.println("IOException from LookupDiscovery constructor");
      }
      _lookupDiscovery
View Full Code Here


      LookupLocatorDiscovery disco =
    new LookupLocatorDiscovery(locArray);
      disco.addDiscoveryListener(new Discoverer());
  }
  else {
      LookupDiscovery disco = new LookupDiscovery(_groups);
      disco.addDiscoveryListener(new Discoverer());
  }
    }
View Full Code Here

  Entry[] attrs = new Entry[]
  { new BasicServiceType(serviceType) };
  _serviceTemplate = new ServiceTemplate(null, null, attrs);
   
  // set up for discovery
  LookupDiscovery disco = new LookupDiscovery(_groups);
  disco.addDiscoveryListener(new Discoverer());
    }
View Full Code Here

  /* Use LookupLocatorDiscovery to find a Lookup Service */
  if (_lookupSrvc == null) { // first time
      // Use LookupDiscovery to find a Lookup Service
      try {
    System.out.println("LookupDiscovery for " + _groupsToJoin[0]);
    _lookupDiscovery = new LookupDiscovery(_groupsToJoin);
      }
      catch (IOException e) {
    System.out.println("IOException from LookupDiscovery constructor");
      }
      _lookupDiscovery
View Full Code Here

      discoveryManager = (DiscoveryManagement) config.getEntry(
    "com.sun.jini.example.hello.Server", "discoveryManager",
    DiscoveryManagement.class);
  } catch (NoSuchEntryException e) {
            /* Use the public group */
      discoveryManager = new LookupDiscovery(
    new String[] { "" }, config);
  }

  /* Get the join manager, for joining lookup services */
  JoinManager joinManager =
View Full Code Here

    "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(
View Full Code Here

{
    private Configuration config;
    private static final String LDCOMP = "net.jini.discovery.LookupDiscovery";
    public LookupDiscovery setup(Configuration config) throws Exception {
  this.config = config;
  return new LookupDiscovery(DiscoveryGroupManagement.NO_GROUPS, config);
    }
View Full Code Here

            // new Throwable().printStackTrace();
        }
    }

    public void run() throws Exception {
        LookupDiscovery disc = null;
        DiscoveryAdmin admin = null;

  // Create a LookupDiscovery object.
  disc = new LookupDiscovery(Util.makeGroups("start", 700),
           getConfig().getConfiguration());
  logger.log(Level.INFO,
       "constructed with " + disc.getGroups().length + " elements");
  Thread.sleep(10000);
  disc.addDiscoveryListener(new Ignorer());
  ServiceRegistrar reg = createLookup();
  admin = getAdmin(reg);
  String[] actualGroups = new String[] {
      reg.getServiceID().toString() };
  admin.setMemberGroups(actualGroups);
  disc.addGroups(Util.makeGroups("added", 200));
  logger.log(Level.INFO, "increased to " + disc.getGroups().length
       + " elements");
  Thread.sleep(10000);
  disc.removeGroups(Util.makeGroups("start", 300));
  logger.log(Level.INFO,
       "reduced to " + disc.getGroups().length + " elements");
  Thread.sleep(10000);
  disc.setGroups(Util.makeGroups("toasty", 100));
  logger.log(Level.INFO,
       "changed to " + disc.getGroups().length + " elements");
  Thread.sleep(10000);
  disc.setGroups(DiscoveryGroupManagement.ALL_GROUPS);
  logger.log(Level.INFO, "set to ALL_GROUPS");
  Thread.sleep(60000);

  try {
      disc.addGroups(actualGroups);
      throw new TestException("addGroups to null didn't throw anything");
  } catch (UnsupportedOperationException e) {
      // expected
  }

  try {
      disc.removeGroups(actualGroups);
      throw new TestException("removeGroups from null didn't "
          + "throw anything");
  } catch (UnsupportedOperationException e) {
      // expected
  }

  disc.setGroups(DiscoveryGroupManagement.NO_GROUPS);
  logger.log(Level.INFO, "set to NO_GROUPS");
  Thread.sleep(10000);
  Discarder arder = new Discarder(reg.getServiceID(), disc);
  disc.addDiscoveryListener(arder);
  disc.addGroups(actualGroups);
  logger.log(Level.INFO, "increased to " + disc.getGroups().length
       + " elements");
  Thread.sleep(30000);

  if (arder.discovery != true) {
      throw new TestException("no discovered event reported");
  }

  if (arder.discardery != true) {
      throw new TestException("no discarded event reported");
  }

  if (arder.unexpected == true) {
      throw new TestException( "unexpected event reported");
  }
  disc.terminate();

  try {
      disc.addGroups(actualGroups);
      throw new TestException("addGroups after terminate didn't "
          + "throw anything");
  } catch (IllegalStateException e) {
  }

  try {
      disc.removeGroups(actualGroups);
      throw new TestException("removeGroups after terminate didn't "
          + "throw anything");
  } catch (IllegalStateException e) {
  }

  try {
      disc.setGroups(actualGroups);
      throw new TestException("setGroups after terminate didn't "
          + "throw anything");
  } catch (IllegalStateException e) {
  }
    }
View Full Code Here

            }
        }
    }

    public void startDiscovery() throws Exception {
        lookupDiscovery = new LookupDiscovery(DiscoveryGroupManagement.ALL_GROUPS, config);
        recordingListener = new RecordingDiscoveryListener(lookupDiscovery);
        lookupDiscovery.addDiscoveryListener(recordingListener);

        int threadPoolSize = Config.getIntEntry(config,
                                                Constants.COMPONENT,
View Full Code Here

    public void setUp() throws Exception {
        eventManager = new TransientEventManager();
        eventManager.initialize( new EventCollectorContext(EmptyConfiguration.INSTANCE,
                                                           new LinkedBlockingQueue<RemoteEvent>(),
                                                           new EventDescriptor[0],
                                                           new LookupDiscovery(new String[0]),
                                                           null));
    }
View Full Code Here

TOP

Related Classes of net.jini.discovery.LookupDiscovery

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.