Package net.jini.lease

Examples of net.jini.lease.ExpirationWarningEvent


      String message = "ExpirationWarningEvent was never received.";
      throw new TestException(message);
  }
 
  // capture the expiration time of the warning event
  ExpirationWarningEvent warnEvent =
      (ExpirationWarningEvent) warnListener.getEvents()[0];
  long warnEventExpiration =
      prepareLease(warnEvent.getRenewalSetLease()).getExpiration();

  // wait for renewal failure event
  failWaitThread.join(maxWaitTime);

  // if the thread is still alive then the event was never received.
  if (failWaitThread.isAlive() == true) {
      String message = "RenewalFailureEvent was never received.";
      throw new TestException(message);
  }

  // capture the expiration time of the renewal failure event
  RenewalFailureEvent failEvent =
      (RenewalFailureEvent) failListener.getEvents()[0];
  long failEventExpiration = failEvent.getLease().getExpiration();

  logger.log(Level.FINE, "Number of failure events = " +
        warnListener.getEvents().length);
  logger.log(Level.FINE, "Number of warning events = " +
        failListener.getEvents().length);


  /* ASSERTION #1 :
     assert that the leases are the ones we expect */
  if (warnLease.equals(prepareLease(warnEvent.getRenewalSetLease())) == false) {
      String message = "Assertion #1 failed.\n" +
    "Expiration warning lease does not match\n" +
    "the lease encapsulated in the ExpirationWarningEvent " +
    "object.";
      throw new TestException(message);
View Full Code Here


      throw new TestException(message);
  }

  // assert that each event holds the expected ID value
  for (int i = 0; i < events.length; ++i) {
      ExpirationWarningEvent ewe =
    (ExpirationWarningEvent) events[i];
      if (ewe.getID() !=
    LeaseRenewalSet.EXPIRATION_WARNING_EVENT_ID) {
      String message = "Event #" + i + " has the wrong event ID.\n" +
    "ID = " + ewe.getID() + " but it should be " +
    LeaseRenewalSet.EXPIRATION_WARNING_EVENT_ID;
      throw new TestException(message);
      }
  }
    }
View Full Code Here

      throw new TestException(message);
  }

  // assert that each event holds the expected ID value
  for (int i = 0; i < events.length; ++i) {
      ExpirationWarningEvent ewe =
    (ExpirationWarningEvent) events[i];
      if (ewe.getID() !=
    LeaseRenewalSet.EXPIRATION_WARNING_EVENT_ID) {
      String message = "Event #" + i + " has the wrong event ID.\n" +
    "ID = " + ewe.getID() + " but it should be " +
    LeaseRenewalSet.EXPIRATION_WARNING_EVENT_ID;
      throw new TestException(message);
      }
  }
    }
View Full Code Here

      String message = "ExpirationWarningEvent was never received.";
      throw new TestException(message);
  }
 
  // capture the expiration time of the warning event
  ExpirationWarningEvent warnEvent =
      (ExpirationWarningEvent) warnListener.getEvents()[0];
  long warnEventExpiration =
      prepareLease(warnEvent.getRenewalSetLease()).getExpiration();

  // wait for renewal failure event
  failWaitThread.join(maxWaitTime);

  // if the thread is still alive then the event was never received.
  if (failWaitThread.isAlive() == true) {
      String message = "RenewalFailureEvent was never received.";
      throw new TestException(message);
  }

  // capture the expiration time of the renewal failure event
  RenewalFailureEvent failEvent =
      (RenewalFailureEvent) failListener.getEvents()[0];
  long failEventExpiration = failEvent.getLease().getExpiration();

  logger.log(Level.FINE, "Number of failure events = " +
        warnListener.getEvents().length);
  logger.log(Level.FINE, "Number of warning events = " +
        failListener.getEvents().length);


  /* ASSERTION #1 :
     assert that the leases are the ones we expect */
  if (warnLease.equals(prepareLease(warnEvent.getRenewalSetLease())) == false) {
      String message = "Assertion #1 failed.\n" +
    "Expiration warning lease does not match\n" +
    "the lease encapsulated in the ExpirationWarningEvent " +
    "object.";
      throw new TestException(message);
View Full Code Here

  // Inherit java doc from super type
  public RemoteEvent createEvent(long             eventID,
               long             seqNum,
               MarshalledObject handback)
  {
      return new ExpirationWarningEvent(proxy, seqNum, handback);
 
View Full Code Here

    setRsltIfNeeded("TEST CODE ERROR:Event recived before " +
        "OurListener was fully initialized");
    return;
      }
      try {
    final ExpirationWarningEvent ewe =
        (ExpirationWarningEvent)theEvent;
    if (ewe == null) {
        logger.log(Level.INFO, "notify called with null event");
        setRsltIfNeeded(" notify called with null event");
        return;
    }
    if (!registation.getLease().equals(prepareNormLease(ewe.getRenewalSetLease()))) {
        logger.log(Level.INFO, "Lease miss-match");
        setRsltIfNeeded("Lease in warning event did not " +
            "match set lease");
        return;
    }

    // $$$ should also check lease in event to make sure
    // expiration is up to date.

    // deal with renewing the lease
    logger.log(Level.INFO, "Renewing set lease");
    prepareNormLease(ewe.getRenewalSetLease()).renew(Lease.FOREVER);
   
      } catch (ClassCastException e) {
    setRsltIfNeeded("Event was not of type ExpirationWarningEvent");
    return;
      } catch (Exception e) {
View Full Code Here

    return;
      }

      // Check Lease and type of event
      try {
    final ExpirationWarningEvent ewe =
        (ExpirationWarningEvent)theEvent;
    final Lease eventLease =
                    prepareNormLease(ewe.getRenewalSetLease());

    if (!setLease.equals(eventLease)) {
        logger.log(Level.INFO, "Lease miss-match");
        setRsltIfNeeded("Lease in warning event did not " +
            "match set lease");
View Full Code Here

TOP

Related Classes of net.jini.lease.ExpirationWarningEvent

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.