RExpirable added

pull/179/head
Nikita 10 years ago
parent 596100138b
commit 52168d064e

@ -27,8 +27,8 @@ import java.util.concurrent.locks.Lock;
*
*/
public interface RLock extends Lock, RObject {
public interface RLock extends Lock, RExpirable {
/**
* Acquires the lock.
*
@ -36,27 +36,27 @@ public interface RLock extends Lock, RObject {
* disabled for thread scheduling purposes and lies dormant until the
* lock has been acquired.
*
* If the lock is acquired, it is held until <code>unlock</code> is invoked,
* or until leaseTime have passed
* If the lock is acquired, it is held until <code>unlock</code> is invoked,
* or until leaseTime have passed
* since the lock was granted - whichever comes first.
*
* @param leaseTime the maximum time to hold the lock after granting it,
*
* @param leaseTime the maximum time to hold the lock after granting it,
* before automatically releasing it if it hasn't already been released by invoking <code>unlock</code>.
* If leaseTime is -1, hold the lock until explicitly unlocked.
* If leaseTime is -1, hold the lock until explicitly unlocked.
* @param unit the time unit of the {@code leaseTime} argument
* @throws InterruptedException - if the thread is interrupted before or during this method.
* @throws InterruptedException - if the thread is interrupted before or during this method.
*/
void lockInterruptibly(long leaseTime, TimeUnit unit) throws InterruptedException;
/**
* Returns <code>true</code> as soon as the lock is acquired.
* If the lock is currently held by another thread in this or any
* other process in the distributed system this method keeps trying
* to acquire the lock for up to <code>waitTime</code> before
* giving up and returning <code>false</code>. If the lock is acquired,
* it is held until <code>unlock</code> is invoked, or until <code>leaseTime</code>
* Returns <code>true</code> as soon as the lock is acquired.
* If the lock is currently held by another thread in this or any
* other process in the distributed system this method keeps trying
* to acquire the lock for up to <code>waitTime</code> before
* giving up and returning <code>false</code>. If the lock is acquired,
* it is held until <code>unlock</code> is invoked, or until <code>leaseTime</code>
* have passed since the lock was granted - whichever comes first.
*
*
* @param waitTime the maximum time to aquire the lock
* @param leaseTime
* @param unit
@ -64,7 +64,7 @@ public interface RLock extends Lock, RObject {
* @throws InterruptedException
*/
boolean tryLock(long waitTime, long leaseTime, TimeUnit unit) throws InterruptedException;
/**
* Acquires the lock.
*
@ -72,18 +72,18 @@ public interface RLock extends Lock, RObject {
* disabled for thread scheduling purposes and lies dormant until the
* lock has been acquired.
*
* If the lock is acquired, it is held until <code>unlock</code> is invoked,
* or until leaseTime milliseconds have passed
* If the lock is acquired, it is held until <code>unlock</code> is invoked,
* or until leaseTime milliseconds have passed
* since the lock was granted - whichever comes first.
*
* @param leaseTime the maximum time to hold the lock after granting it,
*
* @param leaseTime the maximum time to hold the lock after granting it,
* before automatically releasing it if it hasn't already been released by invoking <code>unlock</code>.
* If leaseTime is -1, hold the lock until explicitly unlocked.
* If leaseTime is -1, hold the lock until explicitly unlocked.
* @param unit the time unit of the {@code leaseTime} argument
*
*
*/
void lock(long leaseTime, TimeUnit unit);
/**
* Unlocks lock independently of state
*

Loading…
Cancel
Save