Package com.sun.jini.landlord
Interface LeasePeriodPolicy
- All Known Implementing Classes:
FixedLeasePeriodPolicy,SystemTimeFixedLeasePeriodPolicy
public interface LeasePeriodPolicy
Interface for objects that define what policy to use when calculating lease grants and renewals.
- Since:
- 2.0
- Author:
- Sun Microsystems, Inc.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic classSimple class that holds a pair of times, the new expiration and duration for a lease. -
Method Summary
Modifier and TypeMethodDescriptiongrant(LeasedResource resource, long requestedDuration) Calculate the initial expiration and duration for a new lease.renew(LeasedResource resource, long requestedDuration) Calculate the expiration and duration for an existing lease that is being renewed.
-
Method Details
-
grant
LeasePeriodPolicy.Result grant(LeasedResource resource, long requestedDuration) throws LeaseDeniedException Calculate the initial expiration and duration for a new lease.- Parameters:
resource- the server side representation of the new lease that needs an initial expiration and durationrequestedDuration- the initial duration the requester of the resources would like. May beLease.ANY- Returns:
- A
Resultthat holds both the expiration and duration. - Throws:
LeaseDeniedException- if the grant request is denied.IllegalArgumentException- if the requested duration is notLease.ANYand is negative.
-
renew
LeasePeriodPolicy.Result renew(LeasedResource resource, long requestedDuration) throws LeaseDeniedException Calculate the expiration and duration for an existing lease that is being renewed.- Parameters:
resource- the server side representation of the lease that is being renewedrequestedDuration- the duration the client is requesting. May beLease.ANY.- Returns:
- A
Resultthat holds both the expiration and duration. - Throws:
LeaseDeniedException- if the renewal request is denied.IllegalArgumentException- if the requested duration is notLease.ANYand is negative.
-