Package net.jini.core.lease

Examples of net.jini.core.lease.Lease


  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

      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

  rstUtil.waitForLeaseExpiration(lease[5],
       "for the remaining client leases to expire.");

  // assert that all leases have expired
  for (int i = 0; i < 6; ++i) {
      Lease managedLease = set.remove(lease[i]);
      if (managedLease != null) {
    String message = "Lease #" + i + " did not expire as " +
        "expect.";
    throw new TestException(message);
      }
View Full Code Here

     * leases are discarded.
     */
    public void cancelTrackedLeases() {
  Iterator iter = leaseArray.iterator();
  while (iter.hasNext()) {
     Lease lease = (Lease) iter.next();
     try {
         lease.cancel();
     } catch (UnknownLeaseException ignore) {
     } catch (RemoteException ex) {
         logger.log(Level.INFO, "Failed to cancel lease", ex);
     }
  }
View Full Code Here

     
      final List leases = new LinkedList();
      final List problems = new LinkedList();
      final List exceptions = new LinkedList();
      for (int i=0; i<mls.length; i++) {
    Lease l;
    final MarshalledInstance ml = mls[i];
    try {
        l = (Lease) ml.get(result.verifyCodebaseIntegrity());
        leases.add(l);
    } catch (Throwable t) {
View Full Code Here

        public void notify(LeaseRenewalEvent e) {
                Throwable ex = e.getException();
    if ( (ex == null) || (ex instanceof UnknownLeaseException) ) {
                    synchronized(joinSet) {
                        removeTasks(ProxyReg.this);
                        Lease expiredLease = e.getLease();
                        // Maybe re-register
                        int indx = joinSet.indexOf(ProxyReg.this);
                        if(indx >= 0) {//new proxyReg/old ProxyReg.this in set
                            ProxyReg curProxyReg = (ProxyReg)joinSet.get(indx);
                            if(expiredLease.equals(curProxyReg.serviceLease)) {
                                // Okay to re-register
                                addTask(new LeaseExpireNotifyTask
                                                (ProxyReg.this,
                                                 (Entry[])lookupAttr.clone()));
                            }//endif
View Full Code Here

     * necessary.  If it can't be unpacked or prepared, return null.
     */
    // $$$ this might want to be synchronized
    Lease getClientLease() {
  if (clientLease == null) {
      Lease unmarshalledLease = null;
      try {
    unmarshalledLease = (Lease) marshalledClientLease.get(false);
      } catch (IOException e) {
    logger.log(Levels.HANDLED,
         "Problem unmarshalling lease -- will retry later",
View Full Code Here

     * <p>
     * Assumes that no one else will be serializing the lease
     * during this call.
     */
    MarshalledInstance getMarshalledClientLease() {
  final Lease cl = getClientLease();

  if (cl == null) {
      // We are deformed, best we can do is return the (possibly
      // stale) pre-marshalled lease we already have
      return marshalledClientLease;
  } else {
      try {
    cl.setSerialFormat(Lease.DURATION);
    return new MarshalledInstance(cl);
      } catch (IOException e) {
    // Can't create a new MarshalledInstance, return the old one
    return marshalledClientLease;
      } finally {
    cl.setSerialFormat(Lease.ABSOLUTE);
      }
  }
    }
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.