Package net.jini.core.lookup

Examples of net.jini.core.lookup.ServiceRegistrar


     *  discovered.
     */
    protected ServiceRegistrar[] getRegsToDiscover(ArrayList useList) {
        ArrayList regsList = new ArrayList();
        for(int i=0;i<useList.size();i++) {
            ServiceRegistrar reg =
                   ( ((DiscoveryStruct)(useList.get(i))).regGroups ).reg;
            if(reg == nullcontinue;
            regsList.add(reg);
        }
        return (ServiceRegistrar[])(regsList).toArray
View Full Code Here


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

  if(len > 0) {
            /* loop thru the set of lookups, randomly selecting each lookup */
      int rand = (Math.abs(random.nextInt())) % len;
      for(int i=0; i<len; i++) {
                int max = maxMatches;
    ServiceRegistrar proxy = proxys[(i + rand) % len];
    try {
                    /* If a filter is to be applied (filter != null), then
                     * the value of the maxMatches parameter will not
                     * suffice when querying the current lookup service.
                     * This is because although services returned from a
                     * query of the lookup service will match the template,
                     * some of those services may get filtered out. Thus,
                     * asking for exactly maxMatches may result in fewer
                     * matching services than actually are contained in
                     * the lookup. Thus, all matching services are
                     * 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

                super(reg, seqN);
    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;
                    synchronized(serviceIdMap) {
      eReg.lookupsPending--;
                        cacheTerminated = bCacheTerminated;
View Full Code Here

            }//end constructor

            public void run() {
                logger.finest("ServiceDiscoveryManager - UnmapProxyTask "
                              +"started");
    ServiceRegistrar proxy = null;
                ServiceItem item;
                synchronized(itemReg) {
                    item = itemReg.removeProxy(reg.proxy);//disassociate the LUS
        if (item != null) {// new LUS chosen to track changes
      proxy = itemReg.proxy;
View Full Code Here

                                               (oldDesiredRegs,regInfo)// f.
                HashMap discardRegs = new HashMap(undesiredRegs.size());
                for(Iterator itr = (undesiredRegs.keySet()).iterator();
                                                              itr.hasNext(); )
                {
                    ServiceRegistrar reg = (ServiceRegistrar)itr.next();
                    (regInfo.discoveredRegsMap).remove(reg);              // g.
                    discardRegs.put(reg,
                    ((LocatorGroupsStruct)allDiscoveredRegs.get(reg)).groups);

                }//end loop
View Full Code Here

                 */
                HashMap discardRegs = new HashMap(undesiredRegs.size());
                for(Iterator itr = (undesiredRegs.keySet()).iterator();
                                                              itr.hasNext(); )
                {
                    ServiceRegistrar reg = (ServiceRegistrar)itr.next();
                    (regInfo.discoveredRegsMap).remove(reg);
                    discardRegs.put(reg,
                    ((LocatorGroupsStruct)allDiscoveredRegs.get(reg)).groups);
                }//end loop
                /* Construct the registrars-to-groups map for the event */
 
View Full Code Here

  logger.log(Level.FINE,
       "querying the lookup service "
       +"to verify all service registrations ...");
  ArrayList lusList = getLookupListSnapshot
      ("impl.joinmanager.RegisterStorm");
  ServiceRegistrar reg = (ServiceRegistrar)lusList.get(0);
  /* Verify nServices registered with lookup service 0 */
  ServiceMatches matches = reg.lookup(template,
              Integer.MAX_VALUE);
  int nRegServices = matches.totalMatches;
  logger.log(Level.FINE, "# of services expected   = " + nServices);
  logger.log(Level.FINE, "# of services registered = " + nRegServices);
  if(nServices != nRegServices) {
View Full Code Here

        LookupLocator[] locs = toLocatorArray(lookupsStarted);
        mainListener.setLookupsToDiscover(lookupsStarted, locs);
        ldm = getLookupDiscoveryManager(locs);
        waitForDiscovery(mainListener);//won't get past here if discovery fails
        /* lookup service */
        ServiceRegistrar lus = (ldm.getRegistrars())[0];
        /* default maximum lease duration from the lookup service */
        int idSeed  = SERVICE_BASE_VALUE + 9999;
        long lowBits = (1000+idSeed) >> 32;
        long leastSignificantBits = SERVICE_ID_VARIANT | lowBits;
        ServiceID testID =
                    new ServiceID( SERVICE_ID_VERSION, leastSignificantBits );
        ServiceRegistration srvcReg =
                      lus.register(new ServiceItem(testID,testService,null),
                                   Long.MAX_VALUE);
        Lease srvcLease = null;
        srvcReg = (ServiceRegistration) getConfig().prepare
                                    ("test.reggieServiceRegistrationPreparer",
                                     srvcReg);
View Full Code Here

         */
        HashMap regsToAdd = new HashMap(regsMap.size());
        Set eSet = regsMap.entrySet();
        for(Iterator itr = eSet.iterator(); itr.hasNext(); ) {
            Map.Entry pair = (Map.Entry)itr.next();
            ServiceRegistrar reg = (ServiceRegistrar)pair.getKey();
            LocatorGroupsStruct curStructVal
                                      = (LocatorGroupsStruct)pair.getValue();
            /* If regInfo wants ALL_GROUPS, then every registrar is desired */
            if(regInfo.groups == null) { // ALL_GROUPS
                regsToAdd.put(reg,curStructVal);
View Full Code Here

TOP

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

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.