LockingVisitors.ReadWriteLockVisitor (Apache Commons Lang 3.17.0 API)
Description: declaration: package: org.apache.commons.lang3.concurrent.locks, class: LockingVisitors, class: ReadWriteLockVisitor

Package org.apache.commons.lang3.concurrent.locks

# Class LockingVisitors.ReadWriteLockVisitor<O>

java.lang.Object
org.apache.commons.lang3.concurrent.locks.LockingVisitors.LockVisitor<O,ReadWriteLock>
org.apache.commons.lang3.concurrent.locks.LockingVisitors.ReadWriteLockVisitor<O>

Type Parameters:
  `O` - The locked (hidden) objects type.

Enclosing class:
  LockingVisitors

public static class LockingVisitors.ReadWriteLockVisitor<O> extends LockingVisitors.LockVisitor<O,ReadWriteLock>
This class implements a wrapper for a locked (hidden) object, and provides the means to access it. The basic idea, is that the user code forsakes all references to the locked object, using only the wrapper object, and the accessor methods `LockingVisitors.LockVisitor.acceptReadLocked(FailableConsumer)`, `LockingVisitors.LockVisitor.acceptWriteLocked(FailableConsumer)`, `LockingVisitors.LockVisitor.applyReadLocked(FailableFunction)`, and `LockingVisitors.LockVisitor.applyWriteLocked(FailableFunction)`. By doing so, the necessary protections are guaranteed.

- ## Constructor Summary

  Constructors
  Modifier
  Constructor
  Description
  `protected`
  `ReadWriteLockVisitor(O object, ReadWriteLock readWriteLock)`
  Creates a new instance with the given locked object.

- ## Method Summary

  ### Methods inherited from class org.apache.commons.lang3.concurrent.locks.LockingVisitors.LockVisitor

  `acceptReadLocked, acceptWriteLocked, applyReadLocked, applyWriteLocked, getLock, getObject, lockAcceptUnlock, lockApplyUnlock`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### ReadWriteLockVisitor

    protected ReadWriteLockVisitor(O object, ReadWriteLock readWriteLock)
    Creates a new instance with the given locked object. This constructor is supposed to be used for subclassing only. In general, it is suggested to use `LockingVisitors.stampedLockVisitor(Object)` instead.
    Parameters:
      `object` - The locked (hidden) object. The caller is supposed to drop all references to the locked object.
      `readWriteLock` - the lock to use.