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

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void acquire​(java.util.UUID theTxId)
      Tries to acquire a lock for a transaction.
      boolean acquire​(java.util.UUID theTxId, long theTime, java.util.concurrent.TimeUnit theTimeUnit)
      Tries to acquire a lock for a transaction.
      boolean isAcquired​(java.util.UUID theTxId)  
      boolean isAcquiredByAny()  
      void release​(java.util.UUID theTxId)
      Release a lock for a transaction.
      void releaseAll()
      Release all locks for transactions that have been acquired.
    • Method Detail

      • acquire

        void acquire​(java.util.UUID theTxId)
              throws java.lang.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:
        java.lang.Exception
      • acquire

        boolean acquire​(java.util.UUID theTxId,
                        long theTime,
                        java.util.concurrent.TimeUnit theTimeUnit)
                 throws java.lang.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:
        java.lang.Exception
      • release

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

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

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

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