Interface LockResource

    • Method Detail

      • isClosed

        boolean isClosed()
        Returns:
        true if this LockResource has been closed
      • close

        void close()
        Close the LockResource and unlocks (removes) the lock.

        Note: unlike LockManager.unlock(String) this may be invoked by another thread, allowing delegation of unlocking the lock to another thread

        Warning: while the LockResource may be closed by another thread, the lock itself remains tied to the thread creating it!
        Therefore the thread creating the lock must NOT be terminated before the other thread completes the process requiring the lock, as the lock then may expire prematurely!

        Specified by:
        close in interface AutoCloseable
      • isNewLock

        boolean isNewLock()
        Returns:
        true if this getLock() was created together with this LockResource instance; false if this getLock() already was created earlier by the same thread creating this LockResource.
      • getHolder

        Thread getHolder()
        Returns:
        the Thread that holds this LockResource or null in case the Thread that created this lock has already stopped and been GC-ed