Class AbstractReadWriteLockOperation

  • All Implemented Interfaces:
    PropertyBindable, PropertyConstrainable, Operation, Task, java.lang.Runnable, java.util.concurrent.locks.ReadWriteLock

    public abstract class AbstractReadWriteLockOperation
    extends AbstractOperation
    implements java.util.concurrent.locks.ReadWriteLock
    Abstract implementation of some operation that can be executed, with state governed by a read/write lock.

    This implementation is thread-safe, providing its own read/write lock. The state is governed by this read/write lock, which can also be used for locking other operation resources.

    Author:
    Garret Wilson
    • Constructor Detail

      • AbstractReadWriteLockOperation

        public AbstractReadWriteLockOperation()
        Default constructor using a reentrant read/write lock.
      • AbstractReadWriteLockOperation

        public AbstractReadWriteLockOperation​(java.util.concurrent.locks.ReadWriteLock readWriteLock)
        Read write lock constructor.
        Parameters:
        readWriteLock - The lock for controlling access to the properties.
        Throws:
        java.lang.NullPointerException - if the given lock is null.
    • Method Detail

      • readLock

        public java.util.concurrent.locks.Lock readLock()
        Returns the lock used for reading.
        Specified by:
        readLock in interface java.util.concurrent.locks.ReadWriteLock
        Returns:
        the lock used for reading.
      • writeLock

        public java.util.concurrent.locks.Lock writeLock()
        Returns the lock used for writing.
        Specified by:
        writeLock in interface java.util.concurrent.locks.ReadWriteLock
        Returns:
        the lock used for writing.