|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface Lease
Lease - like a Sync, but locks are only granted for a given period after which they automatically unlock themselves. This is an important construct in a distributed, HA system as, even in the case of failure, a locked resource will be correctly unlocked.
| Nested Class Summary | |
|---|---|
static interface |
Lease.Handle
|
| Method Summary | |
|---|---|
Lease.Handle |
acquire(long leasePeriod)
acquire a lease for a given period |
Lease.Handle |
attempt(long timeframe,
long leasePeriod)
attempt the acquisition of a lease for a given period within a given timeframe |
boolean |
release(Lease.Handle handle)
A misleading name - 'release' as in 'unlock' the lease corresponding to the given handle |
| Methods inherited from interface java.util.concurrent.locks.Lock |
|---|
lock, lockInterruptibly, newCondition, tryLock, tryLock, unlock |
| Method Detail |
|---|
Lease.Handle acquire(long leasePeriod)
throws java.lang.InterruptedException
leasePeriod - the given period (in millis)
java.lang.InterruptedException
Lease.Handle attempt(long timeframe,
long leasePeriod)
throws java.lang.InterruptedException
timeframe - the timeframe within which to try to acquire the lease (in millis)leasePeriod - the period for which the lease is required (in millis)
java.lang.InterruptedExceptionboolean release(Lease.Handle handle)
handle - the handle of the Lease to be 'released'
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||