Package net.jini.core.lease

Examples of net.jini.core.lease.Lease


    //Delete Queue services
    //Delete Job services
    //Delete leases
    try {
      while(!leaseList.isEmpty()) {
        Lease lease = (Lease)leaseList.firstElement();
        lease.cancel();
        leaseList.remove(lease);
        //System.out.println("--RMServer--: deleting lease");
      }
    } catch(Exception ex) {
      //System.out.println("--RMServer--: Exception in shutdown");
View Full Code Here


        ((SingleJobStatusTracer)
         tracerTable.remove(e.nextElement())).terminate();
      }
      while(!leaseList.isEmpty()) {
        //System.out.println("--RMAdapter--: deleting lease");
        Lease lease = (Lease)leaseList.firstElement();
        lease.cancel();
        leaseList.remove(lease);
      }
      if(nativeSGERMAdapter != null) {
        nativeSGERMAdapter.sgeGDIShutdown();
        nativeSGERMAdapter = null;
View Full Code Here

      message += "failed.";
      throw new TestException(message, ex);
  }     

  // trying to remove the lease should result in null value
  Lease managedLease = set.remove(testLease);
  if (managedLease != null) {
      String message = "Lease was added to renewal set in error\n";
      message += "from a call to renewFor with 0 membership.";
      throw new TestException(message);
  }
View Full Code Here

  sleepTime = doubleDuration * 3 / 4;
  rstUtil.sleepAndTell(sleepTime, "3/4 lease membership duration.");

  /* if the membership duration was honored we should be able
     to remove the lease */
  Lease managedLease = set.remove(testLease);
  if (managedLease == null) { // new membership was not honored
      String message = "The membership duration was apparently ";
      message += "not updated to the longer value\n";
      message += "when the lease was re-added to the set.";
      throw new TestException(message);
View Full Code Here

    "events.\n" + "Should have received exactly one.";
      throw new TestException(message);
  }

  // There is only one event received, now allow lease to expire
  Lease setLease = rrl.getLastLeaseRenewed();
  rstUtil.waitForLeaseExpiration(setLease,
               "for renewal set to expire.");
 
  // lease should now be expired, prove it ...
  try {
View Full Code Here

  logger.log(Level.FINE, "Assertion #3 passed.");

  /* ASSERTION #4
     The lease whose renewal failed should have been removed
     from the renewal set. */
  Lease managedLease = set.remove(failLease);
  if (managedLease != null) {
      String message = "Assertion #4 failed.\n" +
    "Failed lease was never removed from renewal set.";
      throw new TestException(message);
  }
View Full Code Here

  LeaseRenewalSet set = lrs.createLeaseRenewalSet(renewSetDur);
  set = prepareSet(set);
  lrm.renewFor(prepareLease(set.getRenewalSetLease()), renewSetDur, null);

  // grab two instances of the renewal set lease
  Lease lease01 = prepareLease(set.getRenewalSetLease());
  Lease lease02 = prepareLease(set.getRenewalSetLease());

  // they should be the same
  if (lease01.equals(lease02) == false) {
      String message = "GetRenewalSetLease has returned an\n" +
           "invalid lease.";
View Full Code Here

  logger.log(Level.FINE, "Adding managed lease to lease renewal set.");
  set.renewFor(testLease, Long.MAX_VALUE);
 
  // Remove the lease. Removal should succeed.
  logger.log(Level.FINE, "Removing the managed lease from the set.");
  Lease managedLease = set.remove(testLease);
  if (managedLease == null) {
      String message = "Lease could not be removed from\n";
      message += "renewal set.";
      throw new TestException(message);
  }
View Full Code Here

  logger.log(Level.FINE, "Duration == Lease.FOREVER");
  TestLease testLease =
      leaseProvider.createNewLease(leaseOwner, Lease.FOREVER);

  // remove the lease
  Lease managedLease = set.remove(testLease);
  if (managedLease != null) {
      String message = "Removal of non-managed lease does NOT\n" +
           "return null as required.";
      throw new TestException(message);
  }
View Full Code Here

  logger.log(Level.FINE, "Created Set 02 with lease duration of " +
        "Lease.FOREVER.");

  /* assert that attempting to add the set's lease to itself
     generates an IllegalArgumentException */
  Lease setLease = prepareLease(set01.getRenewalSetLease());
  logger.log(Level.FINE, "Lease is " + setLease);
  try {
      set01.renewFor(setLease, renewGrant);
      String message = "An attempt to add a renewal set's lease\n";
      message += " to itself has succeeded.";
      throw new TestException(message);
  } catch (IllegalArgumentException ex) {
      // success, keep on trucking ...
  }     

  /* assert that attempting to add the set01's lease to set02
     generates an IllegalArgumentException */
  try {
      set02.renewFor(setLease, renewGrant);
      String message = "An attempt to add a renewal set's lease\n";
      message += " to another set has succeeded.";
      throw new TestException(message);
  } catch (IllegalArgumentException ex) {
      // success, keep on trucking ...
  }     

  // create a lease that renews normally
  logger.log(Level.FINE, "Creating the lease to be managed.");
  logger.log(Level.FINE, "Duration == " + renewGrant);
  TestLease testLease =
      leaseProvider.createNewLease(leaseOwner,
           rstUtil.durToExp(renewGrant));

  // add the lease to set01
  set01.renewFor(testLease, renewGrant);

  /* assert that attempting to add the test lease to set02
     succeeds. */
  try {
      set02.renewFor(testLease, renewGrant);
      // success
  } catch (IllegalArgumentException ex) {
      String message = "An attempt to add a client lease\n";
      message += " to two different sets has failed.";
      throw new TestException(message, ex);
  }     

  /*
   * Assert that adding set01's lease to set02 succeeds if set01's
   * lease has been cancelled.
   */
  setLease.cancel();
  try {
      set02.renewFor(setLease, renewGrant);
  } catch (IllegalArgumentException ex) {
    throw new TestException("Failed to add an expired set "
          + "lease to another set",
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.