Interface InterProcessTxLock

All Known Implementing Classes:
NonReentrantMutex

public interface InterProcessTxLock
Similar to an InterProcessLock, but we track the locks with specific transaction ids.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    acquire(UUID theTxId)
    Tries to acquire a lock for a transaction.
    boolean
    acquire(UUID theTxId, long theTime, TimeUnit theTimeUnit)
    Tries to acquire a lock for a transaction.
    boolean
    isAcquired(UUID theTxId)
     
    boolean
     
    void
    release(UUID theTxId)
    Release a lock for a transaction.
    void
    Release all locks for transactions that have been acquired.
  • Method Details

    • acquire

      void acquire(UUID theTxId) throws Exception
      Tries to acquire a lock for a transaction. Each call to acquire for a transaction should be balanced with a call to release with the same transaction id. This method blocks until it is able to obtain the lock.
      Parameters:
      theTxId -
      Throws:
      Exception
    • acquire

      boolean acquire(UUID theTxId, long theTime, TimeUnit theTimeUnit) throws Exception
      Tries to acquire a lock for a transaction. Each call to acquire for a transaction should be balanced with a call to release with the same transaction id. This method blocks until the timeout is reached.
      Parameters:
      theTxId -
      theTime -
      theTimeUnit -
      Returns:
      Throws:
      Exception
    • release

      void release(UUID theTxId) throws Exception
      Release a lock for a transaction.
      Parameters:
      theTxId -
      Throws:
      Exception
    • isAcquiredByAny

      boolean isAcquiredByAny() throws IOException
      Returns:
      true if any locks of this type are acquired by any thread/process.
      Throws:
      IOException
    • isAcquired

      boolean isAcquired(UUID theTxId) throws IOException
      Returns:
      true if a lock for the specific transaction is acquired by any thread/process.
      Throws:
      IOException
    • releaseAll

      void releaseAll() throws Exception
      Release all locks for transactions that have been acquired.
      Throws:
      Exception