Class LockingVisitors.StampedLockVisitor<O>
java.lang.Object
org.apache.commons.lang3.concurrent.locks.LockingVisitors.LockVisitor<O,StampedLock>
org.apache.commons.lang3.concurrent.locks.LockingVisitors.StampedLockVisitor<O>
- Type Parameters:
O
- The type of the object to protect.
- Enclosing class:
LockingVisitors
public static class LockingVisitors.StampedLockVisitor<O>
extends LockingVisitors.LockVisitor<O,StampedLock>
Wraps a
StampedLock
and object to protect. To access the object, use the methods LockingVisitors.LockVisitor.acceptReadLocked(FailableConsumer)
,
LockingVisitors.LockVisitor.acceptWriteLocked(FailableConsumer)
, LockingVisitors.LockVisitor.applyReadLocked(FailableFunction)
, and LockingVisitors.LockVisitor.applyWriteLocked(FailableFunction)
. The visitor
holds the lock while the consumer or function is called.- See Also:
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class org.apache.commons.lang3.concurrent.locks.LockingVisitors.LockVisitor
LockingVisitors.LockVisitor.LVBuilder<O,
L, B extends LockingVisitors.LockVisitor.LVBuilder<O, L, B>> -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
StampedLockVisitor
(O object, StampedLock stampedLock) Creates a new instance with the given object and lock. -
Method Summary
Modifier and TypeMethodDescriptionstatic <O> LockingVisitors.StampedLockVisitor.Builder
<O> builder()
Creates a new builder.Methods inherited from class org.apache.commons.lang3.concurrent.locks.LockingVisitors.LockVisitor
acceptReadLocked, acceptWriteLocked, applyReadLocked, applyWriteLocked, getLock, getObject, lockAcceptUnlock, lockApplyUnlock
-
Constructor Details
-
StampedLockVisitor
Creates a new instance with the given object and lock.- Parameters:
object
- The object to protect. The caller is supposed to drop all references to the locked object.stampedLock
- the lock to use.- See Also:
-
-
Method Details
-
builder
Creates a new builder.- Type Parameters:
O
- the wrapped object type.- Returns:
- a new builder.
- Since:
- 3.18.0
-