|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.kuka.common.concurrent.PreemptiveLock
public class PreemptiveLock
A reentrant lock class that allows to preempt and interrupt threads waiting for this lock.
| Constructor Summary | |
|---|---|
PreemptiveLock()
|
|
| Method Summary | |
|---|---|
void |
lockInterruptibly()
Acquires the lock unless the current thread is interrupted. |
void |
preemptLock()
Take the lock as soon as possible, while interrupting other threads waiting for this lock. |
boolean |
tryLock()
Acquires the lock only if it is free at the time of invocation. |
boolean |
tryLock(long time,
TimeUnit unit)
Acquires the lock if it is free within the given waiting time and the current thread has not been interrupted. |
void |
unlock()
Releases the lock. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public PreemptiveLock()
| Method Detail |
|---|
public void preemptLock()
public void lockInterruptibly()
throws InterruptedException
InterruptedException - the thread was interrupted while waiting for the lockLock.lockInterruptibly()public boolean tryLock()
Lock.tryLock()
public boolean tryLock(long time,
TimeUnit unit)
throws InterruptedException
time - the maximum time to wait for the lockunit - the time unit
InterruptedException - the thread was interrupted while waiting for the lockLock.tryLock(long, TimeUnit)public void unlock()
Lock.unlock()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||