Class RWLockResource

    • Constructor Summary

      Constructors 
      Constructor Description
      RWLockResource​(java.util.concurrent.locks.ReentrantReadWriteLock rwLock, LockMode mode, boolean acquireLock, boolean useTryLock)
      Creates a new instance of RW lock that will lock with the given mode.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean downgrade()
      Downgrade from a write to a read lock.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • RWLockResource

        public RWLockResource​(java.util.concurrent.locks.ReentrantReadWriteLock rwLock,
                              LockMode mode,
                              boolean acquireLock,
                              boolean useTryLock)
        Creates a new instance of RW lock that will lock with the given mode.
        Parameters:
        rwLock - the read-write lock backing the resource
        mode - the initial lock mode if acquiring the lock
        acquireLock - whether or not to acquire the lock
        useTryLock - whether or not to use Lock.tryLock() when acquiring the resource
    • Method Detail

      • downgrade

        public boolean downgrade()
        Downgrade from a write to a read lock.
        Returns:
        if a successful downgrade was performed. Returns false if it was read locked