Class ReadWriteLockNamedLock

  • All Implemented Interfaces:
    java.lang.AutoCloseable, NamedLock

    public class ReadWriteLockNamedLock
    extends NamedLockSupport
    Named lock support implementation that is using ReadWriteLock instances. The adapted lock MUST SUPPORT reentrancy, non re-entrant locks will NOT work. It is the responsibility of an adapting lock, to ensure that above lock requirement stands.
    • Field Detail

      • readWriteLock

        private final java.util.concurrent.locks.ReadWriteLock readWriteLock
    • Constructor Detail

      • ReadWriteLockNamedLock

        public ReadWriteLockNamedLock​(java.lang.String name,
                                      NamedLockFactorySupport factory,
                                      java.util.concurrent.locks.ReadWriteLock readWriteLock)
    • Method Detail

      • lockShared

        public boolean lockShared​(long time,
                                  java.util.concurrent.TimeUnit unit)
                           throws java.lang.InterruptedException
        Description copied from interface: NamedLock
        Tries to lock shared, may block for given time. If successful, returns true.
        Throws:
        java.lang.InterruptedException
      • lockExclusively

        public boolean lockExclusively​(long time,
                                       java.util.concurrent.TimeUnit unit)
                                throws java.lang.InterruptedException
        Description copied from interface: NamedLock
        Tries to lock exclusively, may block for given time. If successful, returns true.
        Throws:
        java.lang.InterruptedException