Class OwnableReentrantLock


  • public class OwnableReentrantLock
    extends Object
    A lock that supports reentrancy based on owner (and not on current thread).
    Author:
    Stuart Douglas
    • Constructor Detail

      • OwnableReentrantLock

        public OwnableReentrantLock()
        Creates a new lock instance.
    • Method Detail

      • lock

        public void lock​(Object owner)
      • tryLock

        public boolean tryLock​(long timeValue,
                               TimeUnit timeUnit,
                               Object owner)
      • unlock

        public void unlock​(Object owner)
      • toString

        public String toString()
        Returns a string identifying this lock, as well as its lock state. The state, in brackets, includes either the String "Unlocked" or the String "Locked by" followed by the String representation of the lock owner.
        Overrides:
        toString in class Object
        Returns:
        a string identifying this lock, as well as its lock state.