Interface ReadWriteLock
- All Known Implementing Classes:
ReentrantJavaReadWriteLock
public interface ReadWriteLock
Facility to execute operations with read and write locks.
Non-reentrant read operations are not allowed until all write operations have been finished. Additionally, a write operation can acquire the read lock, but not vice-versa.
-
Method Summary
Modifier and TypeMethodDescription<T> Tread(ValueOperation<T> operation) Executes an operation protected by a read lock.voidread(VoidOperation operation) Executes an operation protected by a read lock.<T> Twrite(ValueOperation<T> operation) Executes an operation protected by a write lock.voidwrite(VoidOperation operation) Executes an operation protected by a write lock.
-
Method Details
-
read
Executes an operation protected by a read lock.- Type Parameters:
T- the operation's return type- Parameters:
operation- the operation to execute- Returns:
- the operation's result
-
read
Executes an operation protected by a read lock.- Parameters:
operation- the operation to execute
-
write
Executes an operation protected by a write lock.- Type Parameters:
T- the operation's return type- Parameters:
operation- the operation to execute- Returns:
- the operation's result
-
write
Executes an operation protected by a write lock.- Parameters:
operation- the operation to execute
-