Package net.jini.core.lookup

Examples of net.jini.core.lookup.ServiceMatches


                int nRegs = regList.size();
                for(int i=0;i<nRegs;i++) {
                    /* Pop the stack of lookups */
                    ServiceRegistrar reg = (ServiceRegistrar)regList.remove(0);
        /* Verify 1 service registered with lookup service i */
        ServiceMatches matches = reg.lookup(template,
              Integer.MAX_VALUE);
        if(matches.totalMatches == 0) {
      throw new TestException("lookup service "+i
               +" -- no matching service found");
        } else if(matches.totalMatches != 1) {
      throw new TestException("lookup service "+i
            +" -- totalMatches ("
            +matches.totalMatches
            +") != 1");
        }//endif
        /* Verify that the given attributes were propagated */
        Entry[] lookupAttrs = matches.items[0].attributeSets;
        logger.log(Level.FINE, "lookup service "+i
             +" -- comparing attributes");
        if(!AttributesUtil.compareAttributeSets(attrs,
                  lookupAttrs,
                  Level.OFF))
                        {
                            logger.log(Level.FINE,
               "                 -- NO MATCH");
                            regList.add(reg);// push it back on the stack
                        } else {
                            logger.log(Level.FINE,
               "                 -- attributes MATCH");
                        }//endif
                 }//end loop
                if(regList.size() == 0) break;
                DiscoveryServiceUtil.delayMS(1000);
                deltaT = System.currentTimeMillis() - T0;
            }//end loop
            /* If propagation failed, display expected & actual attributes */
            if(regList.size() > 0) {
                String retStr = "attributes not propagated successfully "
                                   +"on "+regList.size()+" lookup service(s)";
                logger.log(Level.FINE, retStr);
                AttributesUtil.displayAttributeSet(attrs,
                                                   "expectedAttrs",
                                                   Level.FINE);
                for(int i=0;i<regList.size();i++) {
                    ServiceRegistrar reg = (ServiceRegistrar)regList.get(i);
        ServiceMatches matches = reg.lookup(template,
              Integer.MAX_VALUE);
        if(matches.totalMatches != 1) {
      logger.log(Level.FINE,
           "lookup service "+i+" -- totalMatches "
           +"invalid ("+matches.totalMatches+") ... "
View Full Code Here


  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) {
                logger.log(Level.INFO,
                           "Exception occurred during query, discarding proxy",
                           e);
View Full Code Here

                     * requested by passing in "infinity" for the maximum
                     * number of matches (Integer.MAX_VALUE).
                     */
                    if(filter != null) max = Integer.MAX_VALUE;
                    /* Query the current lookup for matching service(s). */
        ServiceMatches sm = proxy.lookup(tmpl, max);
        int nItems = sm.items.length;
        if(nItems == 0) continue;//no matches, query next lookup
                    /* Loop thru the matching services, randomly selecting
                     * each service, applying the filter if appropriate,
                     * and making sure the service has not already been
View Full Code Here

                this.eReg = eReg;
      }
            public void run() {
                logger.finest("ServiceDiscoveryManager - LookupTask started");
    ServiceRegistrar proxy = reg.proxy;
    ServiceMatches matches;
                /* For the given lookup, get all services matching the tmpl */
    try {
        matches = proxy.lookup(tmpl, Integer.MAX_VALUE);
    } catch (Exception e) {
                    boolean cacheTerminated;
View Full Code Here

                String registrarInfo = "Registrar: " + registrar.getServiceID();
                System.out.println();
                System.out.println(registrarInfo);
                LOG.debug(registrarInfo);
                ServiceTemplate template = new ServiceTemplate(null, null, null);
                ServiceMatches matches = registrar.lookup(template, Integer.MAX_VALUE);
                ServiceItem[] items = matches.items;
                for (int i = 0; i < items.length; i++) {
                    String serviceInfo = "  Service: " + items[i].service;
                    System.out.println(serviceInfo);
                    LOG.debug(serviceInfo);
View Full Code Here

      refreshPanel();
    }

    protected Entry[] getEntryArray() {
      try{
  ServiceMatches matches = registrar.lookup(new ServiceTemplate(item.serviceID,
                      new Class[] { item.service.getClass() },
                      new Entry[] {}),
              10);
  if(matches.totalMatches != 1)
    Browser.logger.log(Level.INFO, "unexpected lookup matches: {0}",
View Full Code Here

                super(reg, seqN);
      }
            public void run() {
                logger.finest("ServiceDiscoveryManager - LookupTask started");
    ServiceRegistrar proxy = reg.proxy;
    ServiceMatches matches;
                /* For the given lookup, get all services matching the tmpl */
    try {
        matches = proxy.lookup(tmpl, Integer.MAX_VALUE);
    } catch (Exception e) {
                    boolean cacheTerminated;
View Full Code Here

  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) {
                logger.log(Level.INFO,
                           "Exception occurred during query, discarding proxy",
                           e);
View Full Code Here

                     * requested by passing in "infinity" for the maximum
                     * number of matches (Integer.MAX_VALUE).
                     */
                    if(filter != null) max = Integer.MAX_VALUE;
                    /* Query the current lookup for matching service(s). */
        ServiceMatches sm = proxy.lookup(tmpl, max);
        int nItems = sm.items.length;
        if(nItems == 0) continue;//no matches, query next lookup
                    /* Loop thru the matching services, randomly selecting
                     * each service, applying the filter if appropriate,
                     * and making sure the service has not already been
View Full Code Here

    buf.append(n);
    buf.append(" registrars, none selected");
      }
      return;
  }
  ServiceMatches matches;
  try {
      matches = lookup.lookup(tmpl, (match || isAdmin) ? 1000 : 0);
  } catch (Throwable t) {
      logger.log(Level.INFO, "lookup failed", t);
      return;
View Full Code Here

TOP

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

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.