Package net.jini.core.lease

Examples of net.jini.core.lease.Lease


  return clientLeaseMap.get(cl);
    }

    // inherit javadoc
    public Object put(Object key, Object value) {
  final Lease cl = checkKey(key);
  checkValue(value);
 
  // At this point we know key is a ClientLeaseWrapper

  /*
 
View Full Code Here


  return clientLeaseMap.put(cl, value);
    }

    // inherit javadoc
    public Object remove(Object key) {
  final Lease cl = checkKey(key);

  wrapperMap.remove(cl);
  return clientLeaseMap.remove(cl);
    }
View Full Code Here

      return clw.getClientLease();
  }

  // inherit javadoc
  public boolean contains(Object o) {
      final Lease cl = getClientLease(o);

      if (cl == null)
    return false;

      final Object eValue = ((Map.Entry) o).getValue();
View Full Code Here

      return value.equals(eValue);
  }

  // inherit javadoc
  public boolean remove(Object o) {
      final Lease cl = getClientLease(o);

      if (cl == null)
    return false;

      final Object eValue = ((Map.Entry) o).getValue();
View Full Code Here

  if (e.getException() == EXPIRED_SET_EXCEPTION)
      return;

  // Paranoia, check to make sure that lease is one of wrapped
  // client lease...if it's not, ignore the event
  final Lease l = e.getLease();
  if (l instanceof ClientLeaseWrapper) {
      final ClientLeaseWrapper clw = (ClientLeaseWrapper) l;
      queue.enqueue(new Discriminator(clw, true));
  }
    }
View Full Code Here

 
    // Inherit java doc from super type
    public void expirationReached(LeaseRenewalEvent e) {
  // Paranoia, check to make sure that lease is one of wrapped
  // client lease...if it's not, ignore the event
  final Lease l = e.getLease();
  if (l instanceof ClientLeaseWrapper) {
      final ClientLeaseWrapper clw = (ClientLeaseWrapper) l;
      queue.enqueue(new Discriminator(clw, false)) ;
  }
    }
View Full Code Here

      return null;
 
  try {
      for (Iterator i = leases.iterator(); i.hasNext(); ) {
    ClientLeaseWrapper clw = (ClientLeaseWrapper) i.next();
    final Lease candidate = clw.getClientLease();
   
    if (candidate != null) {
        // We've got a live one!, remove it from the
        // deformed list and place it in the table
        i.remove();
        table.put(candidate, clw);

        // Is it the one we are looking for?
        if (candidate.equals(clientLease)) {
      return clw;
        }
    }
      }
  } finally {
View Full Code Here

  }

        txntr = new TxnManagerTransaction(
      txnMgrProxy, logmgr, tid, taskpool,
      taskWakeupMgr, this, uuid);
  Lease txnmgrlease = null;
  try {
            Result r = txnLeasePeriodPolicy.grant(txntr, lease);
            txntr.setExpiration(r.expiration);
            txnmgrlease =
          leaseFactory.newLease(
View Full Code Here

        Entry snsh1;
        Entry snsh2;
        SimpleEntry result;
        long leaseTime1 = timeout1;
        long leaseTime2 = timeout2;
        Lease lease1 = null;
        Lease lease2 = null;

        // first check that space is empty
        if (!checkSpace(space)) {
            throw new TestException(
                    "Space is not empty in the beginning.");
View Full Code Here

  specifyServices(new Class[]{LeaseRenewalService.class});
  final LeaseRenewalService lrs = (LeaseRenewalService)services[0];
  LeaseRenewalSet     set =
      lrs.createLeaseRenewalSet(eventWaitFor);
        set = prepareSet(set);
  final Lease setLease = prepareNormLease(set.getRenewalSetLease());
  addLease(setLease, false);


  // Create and register listeners
  warningListener = new WarningListener(failureFails?null:throwThis);
  failureListener = new BaseListener(failureFails?throwThis:null);

  MarshalledObject handback = new MarshalledObject(new Long(3));
  logger.log(Level.FINER, "setting expiration warning listener");
  EventRegistration reg =
      set.setExpirationWarningListener(warningListener,
    eventWaitFor - whenWarning, handback);
  logger.log(Level.FINER, "preparing returned registration");
        reg = prepareNormEventRegistration(reg);
  logger.log(Level.FINER, "completing initialization of listener");
  warningListener.setRegInfo(reg, handback);

  handback = null;
  reg = set.setRenewalFailureListener(failureListener, handback);
  reg = prepareNormEventRegistration(reg);
  failureListener.setRegInfo(reg, handback);

  // Create and add lease that will cause failure
  long now = System.currentTimeMillis();
  Lease l = LocalLease.getFailingLocalLease(now + whenFailure, 0, leaseID, 1, 0);
  set.renewFor(l, Lease.FOREVER);

  // Sleep
  logger.log(Level.INFO, "Sleeping for " + eventWaitFor  + " ms");
  Thread.sleep(eventWaitFor);
View Full Code Here

TOP

Related Classes of net.jini.core.lease.Lease

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.