public class FunctionalReadWriteLock extends Object
| Modifier and Type | Field and Description |
|---|---|
private ReadWriteLock |
lock |
| Modifier | Constructor and Description |
|---|---|
protected |
FunctionalReadWriteLock(ReadWriteLock lock) |
| Modifier and Type | Method and Description |
|---|---|
static FunctionalReadWriteLock |
create(ReadWriteLock lock)
Create a read-write lock around the given standard
ReadWriteLock. |
void |
read(Runnable operation)
Obtain a read lock, perform the operation, and release the lock.
|
<T> T |
read(Supplier<T> operation)
Obtain a read lock, perform the operation, and release the read lock.
|
static FunctionalReadWriteLock |
reentrant()
Create a read-write lock that supports reentrancy.
|
void |
write(Runnable operation)
Obtain an exclusive write lock, perform the operation, and release the lock.
|
<T> T |
write(Supplier<T> operation)
Obtain an exclusive write lock, perform the operation, and release the lock.
|
private final ReadWriteLock lock
protected FunctionalReadWriteLock(ReadWriteLock lock)
public static FunctionalReadWriteLock reentrant()
public static FunctionalReadWriteLock create(ReadWriteLock lock)
ReadWriteLock.lock - the standard lock; may not be nullpublic <T> T read(Supplier<T> operation)
operation - the operation to perform while the read lock is held; may not be nullpublic void read(Runnable operation)
operation - the operation to perform while the read lock is held; may not be nullpublic <T> T write(Supplier<T> operation)
operation - the operation to perform while the write lock is held; may not be nullpublic void write(Runnable operation)
operation - the operation to perform while the write lock is held; may not be nullCopyright © 2021 JBoss by Red Hat. All rights reserved.