Class Locker


  • public class Locker
    extends Object

    Convenience auto closeable ReentrantLock wrapper.

     try (Locker.Lock lock = locker.lock())
     {
       // something 
     }
     
    • Constructor Detail

      • Locker

        public Locker()
    • Method Detail

      • lock

        public Locker.Lock lock()

        Acquires the lock.

        Returns:
        the lock to unlock
      • isLocked

        public boolean isLocked()
        Returns:
        whether this lock has been acquired
      • newCondition

        public Condition newCondition()
        Returns:
        a Condition associated with this lock