Examples of ServiceItem


Examples of net.jini.core.lookup.ServiceItem

        }
        /* lookup(filter) */
        methodStr = new String("lookup(filter)");
        logger.log(Level.FINE, "invoking "+methodStr+" ...");
        try {
            ServiceItem srvcItem = cache.lookup(secondStageFilter);
            logger.log(Level.FINE, errStr+methodStr);
            failed = true;
        } catch(IllegalStateException e) {
            logger.log(Level.FINE, successStr+methodStr);
        }
View Full Code Here

Examples of net.jini.core.lookup.ServiceItem

        long addedWait = getAddedWait();
  regServicesAndCreateCache();
  /* Query the cache for the desired registered service. */
  logger.log(Level.FINE, ""+": querying the cache for the "
       +"service reference(s)");
  ServiceItem srvcItem[] = cache.lookup(secondStageFilter,
                Integer.MAX_VALUE);
  /* Verify the results of the cache query. */
  verifyQueryResults(srvcItem,"first query");
  logger.log(Level.FINE, ""+": # serviceAdded events = "
       +srvcListener.getNAdded());
View Full Code Here

Examples of net.jini.core.lookup.ServiceItem

        long addedWait = getAddedWait();
        regServicesAndCreateCache();
  /* Query the cache for the desired registered service. */
  logger.log(Level.FINE, "querying the cache for the "
       +"service reference(s)");
  ServiceItem srvcItem[] = cache.lookup(secondStageFilter,
                Integer.MAX_VALUE);
  /* Verify the results of the cache query. */
  verifyQueryResults(srvcItem,"first query");
  logger.log(Level.FINE, "# serviceAdded events = "
       +srvcListener.getNAdded());
View Full Code Here

Examples of net.jini.core.lookup.ServiceItem

        cache.discard(srvcItem.service);
        /* Again query the cache for the service. */
        logger.log(Level.FINE, "re-querying the cache for the "
                                        +"discarded service reference");
        srvcItem = cache.lookup(null);
        ServiceItem discardedSrvcItem = cache.lookup(null);
        if(discardedSrvcItem != null) { // failed
      if(discardedSrvcItem.service == null) {
    throw new TestException
        (" -- non-null service item returned, but "
         +"component of returned service is null");
View Full Code Here

Examples of net.jini.core.lookup.ServiceItem

  myLocator = (proxy instanceof RemoteMethodControl) ?
      new ConstrainableLookupLocator(
    unicastDiscoveryHost, unicaster.port, null) :
      new LookupLocator(unicastDiscoveryHost, unicaster.port);
  /* register myself */
  Item item = new Item(new ServiceItem(myServiceID,
               proxy,
               lookupAttrs));
  SvcReg reg = new SvcReg(item, myLeaseID, Long.MAX_VALUE);
  addService(reg);
  if (log != null) {
View Full Code Here

Examples of net.jini.core.lookup.ServiceItem

  int len = proxys.length;
  if(len == 0 ) return null;
  int rand = Math.abs(random.nextInt()) % len;
  for(int i=0; i<len; i++) {
      ServiceRegistrar proxy = proxys[(i + rand) % len];
      ServiceItem sItem = null;
      try {
                int maxMatches = ( (filter != null) ? Integer.MAX_VALUE : 1 );
    ServiceMatches sm = proxy.lookup(tmpl, maxMatches);
    sItem = getMatchedServiceItem(sm, filter);
      } catch(Exception e) {
View Full Code Here

Examples of net.jini.core.lookup.ServiceItem

                              ServiceItemFilter filter,
            long waitDurthrows InterruptedException,
                                                    RemoteException
    {
        /* First query each lookup for the desired service */
        ServiceItem sm = lookup(tmpl,filter);//checkTerminated() is done here
  if(sm != null) return sm;
        /* If the desired service is not in any of the lookups, wait for it. */
  ServiceDiscoveryListener cacheListener
                                        = new ServiceDiscoveryListenerImpl();
        LookupCacheImpl cache = null;
View Full Code Here

Examples of net.jini.core.lookup.ServiceItem

                     * selected (it may have been returned from a previously
                     * queried lookup).
                     */
        int r = (Math.abs(random.nextInt())) % nItems;
        for(int j=0; j<nItems; j++) {
      ServiceItem sItem = sm.items[(j+r) % nItems];
      if(sItem == nullcontinue;
                        if( !filterPassFail(sItem,filter) ) continue;
      if(!isArrayContainsServiceItem(sItemSet, sItem))
          sItemSet.add(sItem);
      if(sItemSet.size() >= maxMatches) {
View Full Code Here

Examples of net.jini.core.lookup.ServiceItem

        synchronized(cacheListener) {
            cache = createLookupCache(tmpl,filter,cacheListener,waitDur);
            long duration = cache.getLeaseDuration();
            while ( duration > 0 ) {
                cacheListener.wait(duration);
                ServiceItem items[] = cacheListener.getServiceItem();
                for(int i=0; i<items.length; i++) {
                    if(!isArrayContainsServiceItem(sItemSet, items[i])) {
                        sItemSet.add(items[i]);
                    }//endif
                }//end loop
View Full Code Here

Examples of net.jini.core.lookup.ServiceItem

    {
  int len = sm.items.length;
  if(len > 0) {
      int rand = Math.abs(random.nextInt()) % len;
      for(int i=0; i<len; i++) {
    ServiceItem sItem = sm.items[(i+rand) % len];
    if(sItem == nullcontinue;
                if( !filterPassFail(sItem,filter) ) continue;
    return sItem;
      }//end loop
  }//endif
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.