|
Groovy Documentation | |||||||
| FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectjava.util.concurrent.locks.ReentrantReadWriteLock
gpars.util.EnhancedRWLock
class EnhancedRWLock extends ReentrantReadWriteLock
Extends ReentrantReadWriteLock with handy withReadLock(Closure) and withWriteLock(Closure) methods to safely lock and unlock the lock for the passed-in closure. Use: def extendedLock = new ExtendedRWLock() extendedLock.withReadLock() {* //read lock locked here }*
| Constructor Summary | |
EnhancedRWLock()
|
|
EnhancedRWLock(boolean fair)
|
|
| Method Summary | |
|---|---|
void
|
withReadLock(groovy.lang.Closure cl)
Performs the passed-in closure with the read lock locked and unlocks the read lock automatically after the closure finishes. |
void
|
withWriteLock(groovy.lang.Closure cl)
Performs the passed-in closure with the write lock locked and unlocks the write lock automatically after the closure finishes. |
| Methods inherited from class ReentrantReadWriteLock | |
|---|---|
| toString, readLock, readLock, writeLock, writeLock, isFair, hasQueuedThreads, hasQueuedThread, getQueueLength, hasWaiters, getWaitQueueLength, getReadLockCount, isWriteLocked, isWriteLockedByCurrentThread, getWriteHoldCount, getReadHoldCount, wait, wait, wait, equals, hashCode, getClass, notify, notifyAll |
| Methods inherited from class Object | |
|---|---|
| wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll |
| Constructor Detail |
|---|
public EnhancedRWLock()
public EnhancedRWLock(boolean fair)
| Method Detail |
|---|
public void withReadLock(groovy.lang.Closure cl)
public void withWriteLock(groovy.lang.Closure cl)
Groovy Documentation