com.sun.jini.lease.landlord
Interface LeasePolicy
- All Known Implementing Classes:
- LeaseDurationPolicy
- public abstract interface LeasePolicy
Interface for classes that implement Lease grant and renewal policies.
Method Summary |
boolean |
ensureCurrent(LeasedResource resource)
Returns true if the lease on the passed resource
has not expired yet. |
Lease |
leaseFor(LeasedResource resource,
long requestedDuration)
Factory method that returns lease objects for the specified
resource. |
long |
renew(LeasedResource resource,
long requestedDuration)
Renews the expiration of the passed resource. |
leaseFor
public Lease leaseFor(LeasedResource resource,
long requestedDuration)
throws LeaseDeniedException
- Factory method that returns lease objects for the specified
resource.
- Parameters:
resource
- The resource the lease is for. Will have its
expiration set.requestedDuration
- The length of lease the client wants.- Returns:
- A lease for the passed resource
- Throws:
- LeaseDeniedException - thrown if the policy is not currently
granting leases.
renew
public long renew(LeasedResource resource,
long requestedDuration)
throws LeaseDeniedException,
UnknownLeaseException
- Renews the expiration of the passed resource.
- Parameters:
resource
- The resource having its lease renewed. Will have its
expiration set.requestedDuration
- The new duration the client wants- Returns:
- The new duration the lease should have.
- Throws:
- LeaseDeniedException - thrown if the policy is unwilling
to renew this lease.
- UnknownLeaseException - does not know of the lease associated
with the passed resource.
ensureCurrent
public boolean ensureCurrent(LeasedResource resource)
- Returns
true
if the lease on the passed resource
has not expired yet.
Copyright © 1999 Sun Microsystems, Inc. All rights reserved