Package net.jini.core.lease

Examples of net.jini.core.lease.UnknownLeaseException


    /** Log and throw a new UnknownLeaseException */
    private UnknownLeaseException throwNewUnknownLeaseException(
            Object cookie)
  throws UnknownLeaseException
    {
  final UnknownLeaseException ule = new UnknownLeaseException();
  if (leaseLogger.isLoggable(Levels.FAILED)) {
      leaseLogger.log(Levels.FAILED, "unable to find lease for " +
          cookie, ule);
  }

View Full Code Here


  throws UnknownLeaseException, LeaseDeniedException
    {
  ready.check();
  final LeaseSet set = (LeaseSet) setTable.get(cookie);
  if (set == null)
      throw new UnknownLeaseException("No lease for cookie:" + cookie);
  try {
      store.acquireMutatorLock();     

      synchronized (set) {
    if (!isCurrent(set)) {
        // Lease has expired, don't renew
        throw new UnknownLeaseException(
      "Lease has already expired");
    }
    // No one can expire the lease, so it is safe to update.
    // $$$ Might be better to make an extra call to currentTime
    // and calculate the new duration just be for returning
View Full Code Here

    // Inherit java doc from super type
    public void cancel(Uuid cookie) throws UnknownLeaseException {
  ready.check();
  final LeaseSet set = (LeaseSet) setTable.get(cookie);
  if (set == null)
      throw new UnknownLeaseException("No lease for cookie:" + cookie);

  try {
      store.acquireMutatorLock();
     
      synchronized (set) {
View Full Code Here

  Long tid = getLeaseTid(uuid);
  TxnManagerTransaction txntr =
          (TxnManagerTransaction)txns.get(tid);

  if (txntr == null)
      throw new UnknownLeaseException();

  // synchronize on the resource so there is not a race condition
  // between renew and expiration
  Result r;
  synchronized (txntr) {
//TODO - check for ACTIVE too?
//TODO - if post-ACTIVE, do anything? 
      if (!ensureCurrent(txntr))
    throw new UnknownLeaseException("Lease already expired");
      long oldExpiration = txntr.getExpiration();
            r = txnLeasePeriodPolicy.renew(txntr, extension);
      txntr.setExpiration(r.expiration);
      expMgr.renewed(txntr);
            if (operationsLogger.isLoggable(Level.FINER)) {
View Full Code Here

  Long tid = getLeaseTid(uuid);
  TxnManagerTransaction txntr =
          (TxnManagerTransaction)txns.get(tid);

  if (txntr == null)
      throw new UnknownLeaseException();

  int state = txntr.getState();

//TODO - need better locking here. getState and expiration need to be checked atomically 
        if ((state == ACTIVE && txntr.getExpiration()==0) || (state != ACTIVE)) {
      throw new UnknownLeaseException("unknown transaction");
        }

    if (state == ACTIVE) {

    try {
   
      synchronized (txntr) {                     
        if(txntr.getExpiration() == 0) {
          throw new TimeoutExpiredException("Transaction already expired", true);
        }
        txntr.setExpiration(0)// Mark as done
      }

          abort(((Long)tid).longValue(), false);
      } catch (TransactionException e) {
          throw new
        UnknownLeaseException("When canceling abort threw:" +
          e.getClass().getName() + ":" + e.getLocalizedMessage());
      }
  }
 
View Full Code Here

   */
  // Check to if this server granted the resource
  if (uuid.getMostSignificantBits() !=
      topUuid.getLeastSignificantBits())
  {
      throw new UnknownLeaseException();
  }

    }
View Full Code Here

  // Has the lease expired?
  if (!ensureCurrent(now)) {
      setRsltIfNeeded("Renwal service let lease expire, " +
          (now - expiration) + " ms late");
      throw new UnknownLeaseException("Lease expired");
  }

  // Have the asked for the right renewal?
  if (!isValidExtension(extension))
      throw new LeaseDeniedException("Did not ask for right extension");
View Full Code Here

    public long renew(Uuid cookie, long extension)
        throws LeaseDeniedException, UnknownLeaseException, RemoteException {
  TestRegistration reg = (TestRegistration) regs.get(cookie);
  synchronized (reg) {
            if (reg.getExpiration() > System.currentTimeMillis())
    throw new UnknownLeaseException("unknown lease");

      return generatorLeasePolicy.renew(reg, extension).duration;
  }
    }
View Full Code Here

    public void cancel(Uuid cookie)
        throws UnknownLeaseException
    {
  TestRegistration reg = (TestRegistration) regs.remove(cookie);
  if (reg == null)
      throw new UnknownLeaseException("Not managaing requested lease");
    }
View Full Code Here

  createAndRegisterLease(
      new RuntimeException("Synthetic RuntimeException"), true, set);
  createAndRegisterLease(
      new Error("Synthetic Error"), true, set);
  createAndRegisterLease(
      new UnknownLeaseException("Synthetic UnknownLeaseException"), true,
      set);
  createAndRegisterLease(
      new LeaseDeniedException("Synthetic LeaseDeniedException"), true,
      set);
  createAndRegisterLease(
View Full Code Here

TOP

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

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.