public class ReentrantReadWriteMutex extends Object implements ReadWriteMutex
Constructor and Description |
---|
ReentrantReadWriteMutex() |
Modifier and Type | Method and Description |
---|---|
void |
lockForReading(Runnable callable)
Lock the config for a read operation that must be read atomic.
|
<V> V |
lockForReading(Supplier<V> callable)
Lock the config for a read operation that must be read atomic.
|
void |
lockForWriting(Runnable callable)
Lock the config for a write operation that must be write atomic, and
could interfere with read operations.
|
<V> V |
lockForWriting(Supplier<V> callable)
Lock the config for a write operation that must be write atomic, and
could interfere with read operations.
|
public void lockForReading(Runnable callable)
ReadWriteMutex
lockForReading
in interface ReadWriteMutex
callable
- The callable operation.public <V> V lockForReading(Supplier<V> callable)
ReadWriteMutex
lockForReading
in interface ReadWriteMutex
V
- The read return value type.callable
- The enclosed callable to be run inside read lock.public void lockForWriting(Runnable callable)
ReadWriteMutex
lockForWriting
in interface ReadWriteMutex
callable
- The callable operation.public <V> V lockForWriting(Supplier<V> callable)
ReadWriteMutex
lockForWriting
in interface ReadWriteMutex
V
- The write return value type.callable
- The callable operation.Copyright © 2017. All rights reserved.