public class ReadWriteLockHelper
extends java.lang.Object
ReadWriteLock instance and provides methods to streamline usage and avoid common inattention mistakes,
such as locking one the lock and unlocking the other in the finally block.| Modifier and Type | Class and Description |
|---|---|
static class |
ReadWriteLockHelper.LockHelper
An helper providing methods to run lambdas within the context of supplied lock.
|
| Constructor and Description |
|---|
ReadWriteLockHelper()
Creates a new instance of the
ReadWriteLockHelper class that wraps a new instance of ReentrantReadWriteLock |
ReadWriteLockHelper(java.util.concurrent.locks.ReadWriteLock lock)
Creates a new instance of the
ReadWriteLockHelper class for the provided lock. |
| Modifier and Type | Method and Description |
|---|---|
java.util.concurrent.locks.ReadWriteLock |
getLock()
Gets the underlying ReadWriteLock instance.
|
ReadWriteLockHelper.LockHelper |
read()
Returns an helper providing methods to run lambdas within the context of the read lock.
|
ReadWriteLockHelper.LockHelper |
write()
Returns an helper providing methods to run lambdas within the context of the write lock.
|
public ReadWriteLockHelper()
ReadWriteLockHelper class that wraps a new instance of ReentrantReadWriteLockpublic ReadWriteLockHelper(java.util.concurrent.locks.ReadWriteLock lock)
ReadWriteLockHelper class for the provided lock.lock - the ReadWriteLock instance to wrap.public java.util.concurrent.locks.ReadWriteLock getLock()
public ReadWriteLockHelper.LockHelper read()
public ReadWriteLockHelper.LockHelper write()
Copyright © 2018 Frederic Thevenet. All rights reserved.