public static class GCUBEReadWriteLock.GCUBEWriteLock extends ReentrantReadWriteLock.WriteLock
ReentrantReadWriteLock.WriteLock that supports
preemptive requests and acquisitions.| Modifier and Type | Method and Description |
|---|---|
void |
cancelPreemptive()
Indicates failure of the preemptive thread.
|
void |
lock()
Deprecated.
use
lockInterruptibly() instead. |
void |
lockInterruptibly() |
void |
lockPreemptively()
Acquires the lock preemptively.
|
boolean |
tryLock()
Extends the semantics of
Lock.tryLock() to cater for lock preemption. |
boolean |
tryLock(long timeout,
TimeUnit unit) |
void |
unlock()
Extends
WriteLock#unlock() to interrupt writer and reader threads in queue for the lock
when invoked by the preemptive thread. |
getHoldCount, isHeldByCurrentThread, newCondition, toStringpublic void lock()
throws org.gcube.common.core.state.GCUBEReadWriteLock.LockPreemptedException
lockInterruptibly() instead.Lock.lock() to cater for lock preemption.lock in interface Locklock in class ReentrantReadWriteLock.WriteLockLockPreemptedException - if the lock is preempted.org.gcube.common.core.state.GCUBEReadWriteLock.LockPreemptedExceptionpublic boolean tryLock()
Lock.tryLock() to cater for lock preemption.tryLock in interface LocktryLock in class ReentrantReadWriteLock.WriteLockfalse if the lock is already held by another thread or has been preempted.public void lockInterruptibly()
throws InterruptedException
lockInterruptibly in interface LocklockInterruptibly in class ReentrantReadWriteLock.WriteLockInterruptedExceptionpublic void lockPreemptively()
throws InterruptedException
LockPreemptedException - if the lock is preempted.InterruptedExceptionpublic boolean tryLock(long timeout,
TimeUnit unit)
throws InterruptedException
tryLock in interface LocktryLock in class ReentrantReadWriteLock.WriteLockInterruptedExceptionpublic void unlock()
WriteLock#unlock() to interrupt writer and reader threads in queue for the lock
when invoked by the preemptive thread.unlock in interface Lockunlock in class ReentrantReadWriteLock.WriteLockpublic void cancelPreemptive()
throws IllegalMonitorStateException
IllegalMonitorStateException - if the calling thread is not the preemptive thread or
it is the preemptive thread but it has already released the lock.Copyright © 2015. All Rights Reserved.