Package net.jini.core.lookup

Examples of net.jini.core.lookup.ServiceRegistration


                    e.printStackTrace();
                    throw new RuntimeException(e.toString());
                }
                logger.log(Level.FINE, "registering test service "
                                              +i+" with lookup service "+loc);
                ServiceRegistration srvcReg =
                 lookupProxy.register(new ServiceItem(srvcID,testService,null),
                                      Long.MAX_VALUE);
    Lease srvcLease = null;
    try {
        srvcReg = (ServiceRegistration) getConfig().prepare(
           "test.reggieServiceRegistrationPreparer",
           srvcReg);
        srvcLease = (Lease) getConfig().prepare(
           "test.reggieServiceRegistrationPreparer",
           srvcReg.getLease());
    } catch (TestException e) {
        throw new RemoteException("Configuration error", e);
    }
                regInfo.srvcID      = srvcID;
                regInfo.srvcReg     = srvcReg;
                regInfo.srvcLease   = srvcLease;
                regInfo.lookupProxy = lookupProxy;
                /* Renew the service's lease until the test is complete */
                leaseRenewalMgr.renewUntil(srvcLease,
                                           Lease.FOREVER, //expiration
                                           leaseListener);//listener
                if(reRegister) {
                    /* Remove old lease from local leaseList and from LRM */
                    leaseRenewalMgr.remove( (Lease)(leaseList.remove(0)) );
                }//endif
                /* Store the new lease for clean up at the end of the test */
                leaseList.add(srvcLease); //add the new lease
                /* Create and set attribute(s) for service just registered */
                if(nAttrs > 0) {
                    regInfo.srvcAttrs = new Entry[nAttrs];
                    Entry[] attrs = new Entry[nAttrs];
                    for(int k=0;k<nAttrs;k++) {
                        logger.log(Level.FINE, "registering attribute "+k
                                          +" with test service "+i);
                        if(k==0) {
                            attrs[k] = new TestServiceIntAttr(attrVal);
                        } else { // placeholder for future attributes
                            attrs[k] = new TestServiceIntAttr(attrVal);
                        }//endif
                        regInfo.srvcAttrs[k] = attrs[k];
                    }//end loop
                    srvcReg.setAttributes(attrs);
                }//endif
                regInfoList.add(regInfo);
            }//end loop (j) - service registration loop
            synchronized(regInfoMap) {
                if(reRegister) {
View Full Code Here


                 * is registered, change the set of attribute(s) associated
                 * with that service.
                 */
                for(int i=0;i<regInfoList.size();i++) {
                    RegInfo regInfo = (RegInfo)(regInfoList.get(i));
                    ServiceRegistration srvcReg = regInfo.srvcReg;
                    Entry[] srvcAttrs = regInfo.srvcAttrs;
                    logger.log(Level.FINE, " service ID    = "+regInfo.srvcID);
                    logger.log(Level.FINE, " service Reg   = "+srvcReg);
                    logger.log(Level.FINE,
             " service Lease = " +regInfo.srvcLease);
View Full Code Here

        throws NoSuchObjectException
   
  concurrentObj.writeLock();
  try {
      ready.check();
      ServiceRegistration reg = registerDo(nitem, leaseDuration);
      if (logger.isLoggable(Level.FINE)) {
    logger.log(
        Level.FINE,
        "registered instance of {0} as {1}",
        new Object[]{
      nitem.serviceType.getName(), reg.getServiceID() });
      }
      return reg;
  } finally {
      concurrentObj.writeUnlock();
  }
View Full Code Here

                                                  serviceItem.service,
                                                  srvcAttrs);
                }//end sync(serviceItem)
            }//end sync(joinSet)
            /* Retrieve and prepare the proxy to the service registration */
            ServiceRegistration tmpSrvcRegistration
                                = proxy.register(tmpSrvcItem, renewalDuration);
            try {
                tmpSrvcRegistration =
                   (ServiceRegistration)registrationPreparer.prepareProxy
                                                       ( tmpSrvcRegistration );
                logger.finest
                          ("JoinManager - ServiceRegistration proxy prepared");
            } catch(Exception e) {
                logger.log(Level.WARNING,
                           "failure during preparation of "
                           +"ServiceRegistration proxy",
                           e);
                throw e; //rethrow the exception since proxy may be unusable
            }
            /* Retrieve and prepare the proxy to the service lease */
            serviceLease = tmpSrvcRegistration.getLease();
            try {
                serviceLease =
                       (Lease)serviceLeasePreparer.prepareProxy(serviceLease);
                logger.finest("JoinManager - service lease proxy prepared");
            } catch(Exception e) {
View Full Code Here

        throws NoSuchObjectException
   
  concurrentObj.writeLock();
  try {
      ready.check();
      ServiceRegistration reg = registerDo(nitem, leaseDuration);
      if (logger.isLoggable(Level.FINE)) {
    logger.log(
        Level.FINE,
        "registered instance of {0} as {1}",
        new Object[]{
      nitem.serviceType.getName(), reg.getServiceID() });
      }
      return reg;
  } finally {
      concurrentObj.writeUnlock();
  }
View Full Code Here

                                                  serviceItem.service,
                                                  srvcAttrs);
                }//end sync(serviceItem)
            }//end sync(joinSet)
            /* Retrieve and prepare the proxy to the service registration */
            ServiceRegistration tmpSrvcRegistration
                                = proxy.register(tmpSrvcItem, renewalDuration);
            try {
                tmpSrvcRegistration =
                   (ServiceRegistration)registrationPreparer.prepareProxy
                                                       ( tmpSrvcRegistration );
                logger.finest
                          ("JoinManager - ServiceRegistration proxy prepared");
            } catch(Exception e) {
    LogUtil.logThrow(logger, Level.WARNING, ProxyReg.class,
          "register", "JoinManager - failure during " +
          "preparation of ServiceRegistration proxy: {0}",
          new Object[] { tmpSrvcRegistration }, e);
                throw e; //rethrow the exception since proxy may be unusable
            }
            /* Retrieve and prepare the proxy to the service lease */
            serviceLease = tmpSrvcRegistration.getLease();
            try {
                serviceLease =
                       (Lease)serviceLeasePreparer.prepareProxy(serviceLease);
                logger.finest("JoinManager - service lease proxy prepared");
            } catch(Exception e) {
View Full Code Here

                    e.printStackTrace();
                    throw new RuntimeException(e.toString());
                }
                logger.log(Level.FINE, "registering test service "
                                              +i+" with lookup service "+loc);
                ServiceRegistration srvcReg =
                 lookupProxy.register(new ServiceItem(srvcID,testService,null),
                                      Long.MAX_VALUE);
    Lease srvcLease = null;
    try {
        srvcReg = (ServiceRegistration) getConfig().prepare(
           "test.reggieServiceRegistrationPreparer",
           srvcReg);
        srvcLease = (Lease) getConfig().prepare(
           "test.reggieServiceRegistrationPreparer",
           srvcReg.getLease());
    } catch (TestException e) {
        throw new RemoteException("Configuration error", e);
    }
                regInfo.srvcID      = srvcID;
                regInfo.srvcReg     = srvcReg;
                regInfo.srvcLease   = srvcLease;
                regInfo.lookupProxy = lookupProxy;
                /* Renew the service's lease until the test is complete */
                leaseRenewalMgr.renewUntil(srvcLease,
                                           Lease.FOREVER, //expiration
                                           leaseListener);//listener
                if(reRegister) {
                    /* Remove old lease from local leaseList and from LRM */
                    leaseRenewalMgr.remove( (Lease)(leaseList.remove(0)) );
                }//endif
                /* Store the new lease for clean up at the end of the test */
                leaseList.add(srvcLease); //add the new lease
                /* Create and set attribute(s) for service just registered */
                if(nAttrs > 0) {
                    regInfo.srvcAttrs = new Entry[nAttrs];
                    Entry[] attrs = new Entry[nAttrs];
                    for(int k=0;k<nAttrs;k++) {
                        logger.log(Level.FINE, "registering attribute "+k
                                          +" with test service "+i);
                        if(k==0) {
                            attrs[k] = new TestServiceIntAttr(attrVal);
                        } else { // placeholder for future attributes
                            attrs[k] = new TestServiceIntAttr(attrVal);
                        }//endif
                        regInfo.srvcAttrs[k] = attrs[k];
                    }//end loop
                    srvcReg.setAttributes(attrs);
                }//endif
                regInfoList.add(regInfo);
            }//end loop (j) - service registration loop
            synchronized(regInfoMap) {
                if(reRegister) {
View Full Code Here

        throws NoSuchObjectException
   
  concurrentObj.writeLock();
  try {
      ready.check();
      ServiceRegistration reg = registerDo(nitem, leaseDuration);
      if (logger.isLoggable(Level.FINE)) {
    logger.log(
        Level.FINE,
        "registered instance of {0} as {1}",
        new Object[]{
      nitem.serviceType.getName(), reg.getServiceID() });
      }
      return reg;
  } finally {
      concurrentObj.writeUnlock();
  }
View Full Code Here

        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);
        srvcLease = (Lease) getConfig().prepare
                                    ("test.reggieServiceRegistrationPreparer",
                                     srvcReg.getLease());
        long defDur = srvcLease.getExpiration() - System.currentTimeMillis();
        srvcLease.cancel();
        /* lease durations to test */
        leaseDur[0] = rfeDur;
        leaseDur[1] = defDur;
View Full Code Here

                 * is registered, change the set of attribute(s) associated
                 * with that service.
                 */
                for(int i=0;i<regInfoList.size();i++) {
                    RegInfo regInfo = (RegInfo)(regInfoList.get(i));
                    ServiceRegistration srvcReg = regInfo.srvcReg;
                    Entry[] srvcAttrs = regInfo.srvcAttrs;
                    logger.log(Level.FINE, " service ID    = "+regInfo.srvcID);
                    logger.log(Level.FINE, " service Reg   = "+srvcReg);
                    logger.log(Level.FINE,
             " service Lease = " +regInfo.srvcLease);
View Full Code Here

TOP

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

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.