com.sun.jini.norm
Class DeformedClientLeaseMapWrapper

java.lang.Object
  extended by com.sun.jini.lease.AbstractLeaseMap
      extended by com.sun.jini.norm.DeformedClientLeaseMapWrapper
All Implemented Interfaces:
Map, LeaseMap

 class DeformedClientLeaseMapWrapper
extends AbstractLeaseMap

An implementation of LeaseMap that holds exactly one lease. Used when we have a deformed lease that we won't be able to batch with anyone else and we want to call ClientLeaseWrapper.renew() instead of LeaseMap.renewAll().

Provides hooks for synchronization and data associated with each client lease while allowing us to use LeaseRenewalManager. Objects of this class are returned by createLeaseMap calls made on ClientLeaseWrapper objects that are deformed.

Author:
Sun Microsystems, Inc.
See Also:
ClientLeaseWrapper

Field Summary
private static long serialVersionUID
           
 
Fields inherited from class com.sun.jini.lease.AbstractLeaseMap
map
 
Constructor Summary
DeformedClientLeaseMapWrapper(ClientLeaseWrapper lease, long duration)
          Create a DeformedClientLeaseMapWrapper.
 
Method Summary
 void cancelAll()
          Cancels all leases in the LeaseMap.
 boolean canContainKey(Object key)
          Returns true if the given object is a Lease which can be renewed and cancelled in a batch with other leases in the map.
 void renewAll()
          Renews all leases in the LeaseMap, using their current values as the renewal durations.
 
Methods inherited from class com.sun.jini.lease.AbstractLeaseMap
checkKey, checkValue, clear, containsKey, containsValue, entrySet, equals, get, hashCode, isEmpty, keySet, put, putAll, remove, size, values
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values
Constructor Detail

DeformedClientLeaseMapWrapper

DeformedClientLeaseMapWrapper(ClientLeaseWrapper lease,
                              long duration)
Create a DeformedClientLeaseMapWrapper.

Parameters:
lease - a Wrapper for the lease that wants to be renewed. May be deformed.
duration - the duration to associate with lease
Method Detail

cancelAll

public void cancelAll()
Description copied from interface: LeaseMap
Cancels all leases in the LeaseMap. If all cancels are successful, returns normally (leaving all leases in the map). Otherwise, removes all leases that failed to cancel from the LeaseMap, and throws LeaseMapException.


renewAll

public void renewAll()
              throws LeaseMapException,
                     RemoteException
Description copied from interface: LeaseMap
Renews all leases in the LeaseMap, using their current values as the renewal durations. If all renewals are successful, returns normally. Otherwise, removes all leases that failed to renew from the LeaseMap, and throws LeaseMapException.

Throws:
LeaseMapException
RemoteException

canContainKey

public boolean canContainKey(Object key)
Description copied from interface: LeaseMap
Returns true if the given object is a Lease which can be renewed and cancelled in a batch with other leases in the map. Whether or not two Lease objects can be batched is an implementation detail determined by the objects.

Parameters:
key - an object that should be a lease
Returns:
true if the lease can be renewed and cancelled in a a batch with other leases
See Also:
Lease.canBatch(net.jini.core.lease.Lease)


Copyright 2007-2010, multiple authors.
Licensed under the Apache License, Version 2.0, see the NOTICE file for attributions.