|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface LeaseFactory
LeaseFactory is responsible for granting new leases, renewing
existing leases and canceling leases when it is no longer needed. For batch
purposes, LeaseFactory creates instances of LeaseGroup.
| Field Summary | |
|---|---|
static long |
DURATION_ANY
This constant represents arbitrary duration. |
static long |
DURATION_FOREVER
This constant represents maximum possible duration. |
| Method Summary | |
|---|---|
void |
cancelLease(Lease existingLease)
Cancels existing lease. |
Lease |
newLease(java.lang.Object leaseTarget,
java.lang.Object tenant,
long requestedDuration,
boolean isAbsolute)
Obtain new lease. |
Lease |
renewLease(Lease existingLease,
long requestedDuration,
boolean isAbsolute)
Renew existing lease. |
| Field Detail |
|---|
static final long DURATION_ANY
LeaseFactory#newLease(Object, long, boolean), implementation
grants lease for a duration that best fits leased resource.
static final long DURATION_FOREVER
LeaseFactory#newLease(Object, long, boolean), implementation
usually will grant lease for a maximum possible duration for leased
resource.
| Method Detail |
|---|
Lease newLease(java.lang.Object leaseTarget,
java.lang.Object tenant,
long requestedDuration,
boolean isAbsolute)
throws LeaseDeniedException
LeaseFactory checks its internal lease map and decides
if the lease can be granted or not. In latter case,
LeaseDeniedException is thrown.
leaseTarget - unique identifier of resource to be leased.tenant - unique identifier of entity that requests lease.leaseDuration - duration of lease in milliseconds.isAbsolute - specified if lease duration is absolute or relative.
Lease representing granted lease. Note,
granted lease might have different duration than requested.
LeaseDeniedException - if lease cannot be granted.
Lease renewLease(Lease existingLease,
long requestedDuration,
boolean isAbsolute)
throws LeaseDeniedException
existingLease has expired, an
exception is thrown. In this case client has to use
#newLease(Object, long, boolean) method to obtain a lease.
leaseTarget - unique identifier of resource to be leased.leaseDuration - duration of lease in milliseconds.isAbsolute - specified if lease duration is absolute or relative.
Lease representing granted lease. Note,
granted lease might have different duration than requested.
LeaseDeniedException - if lease cannot be granted.
void cancelLease(Lease existingLease)
throws UnknownLeaseException
existingLease - lease to cancel.
UnknownLeaseException - if existingLease is unknown
for this lease factory. Usually means that lease was granted by another
factory.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||