Class AutoLock<T extends Lock>

    • Method Detail

      • lock

        public static <T extends LockAutoLock lock​(T lock)
        Locks the given lock and return auto-closable variant.
        Type Parameters:
        T - type of the lock (write/read/common).
        Parameters:
        lock - the lock to wrap.
        Returns:
        an auto-closable instance to be used with try (...) { ... }.
      • getLock

        public T getLock()
        Returns the wrapped lock instance.
        Returns:
        the wrapped lock.
      • lock

        public void lock()
        Specified by:
        lock in interface Lock
      • tryLock

        public boolean tryLock()
        Specified by:
        tryLock in interface Lock
      • unlock

        public void unlock()
        Specified by:
        unlock in interface Lock