Interface AuthorizerLock

All Known Implementing Classes:
AuthorizerLockImpl

@Private @Unstable public interface AuthorizerLock
Authorizer access lock interface. Used by OMMultiTenantManager.
  • Method Details

    • tryReadLock

      long tryReadLock(long timeout) throws InterruptedException
      Attempt to acquire the read lock to the authorizer with a timeout.
      Returns:
      stamp returned from lock op. required when releasing the lock
      Throws:
      InterruptedException
    • unlockRead

      void unlockRead(long stamp)
      Release the read lock to the authorizer. Throws IllegalMonitorStateException if the provided stamp is incorrect.
    • tryOptimisticReadThrowOnTimeout

      long tryOptimisticReadThrowOnTimeout() throws IOException
      Returns:
      stamp that can be passed to validateOptimisticRead(long) to check if a write lock was acquired since the stamp was issued.
      Throws:
      IOException - If an ongoing write prevents the lock from moving to the read state for longer than the timeout.
    • validateOptimisticRead

      boolean validateOptimisticRead(long stamp)
      Returns:
      True if the write lock was not acquired since this stamp was issued for an optimistic read. False otherwise.
    • tryWriteLock

      long tryWriteLock(long timeout) throws InterruptedException
      Attempt to acquire the write lock to authorizer with a timeout.
      Returns:
      stamp
      Throws:
      InterruptedException
    • unlockWrite

      void unlockWrite(long stamp)
      Release the write lock to the authorizer. Throws IllegalMonitorStateException if the provided stamp is incorrect.
    • tryWriteLockThrowOnTimeout

      long tryWriteLockThrowOnTimeout() throws IOException
      A wrapper around tryWriteLock() that throws when timed out.
      Returns:
      stamp
      Throws:
      IOException
    • tryWriteLockInOMRequest

      void tryWriteLockInOMRequest() throws IOException
      A wrapper around tryWriteLockThrowOnTimeout() that is used exclusively in OMRequests. MUST use paired with unlockWriteInOMRequest() for unlocking to ensure correctness.
      Throws:
      IOException
    • unlockWriteInOMRequest

      void unlockWriteInOMRequest()
      A wrapper around unlockWrite() that is used exclusively in OMRequests.
    • isWriteLockHeldByCurrentThread

      boolean isWriteLockHeldByCurrentThread()
      Returns true if the authorizer write lock is held by the current thread. Used in OMMultiTenantManagerImpl.AuthorizerOp.