Interface AuthorizerLock
- All Known Implementing Classes:
AuthorizerLockImpl
@Private
@Unstable
public interface AuthorizerLock
Authorizer access lock interface. Used by OMMultiTenantManager.
-
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns true if the authorizer write lock is held by the current thread.longlongtryReadLock(long timeout) Attempt to acquire the read lock to the authorizer with a timeout.longtryWriteLock(long timeout) Attempt to acquire the write lock to authorizer with a timeout.voidA wrapper around tryWriteLockThrowOnTimeout() that is used exclusively in OMRequests.longA wrapper around tryWriteLock() that throws when timed out.voidunlockRead(long stamp) Release the read lock to the authorizer.voidunlockWrite(long stamp) Release the write lock to the authorizer.voidA wrapper around unlockWrite() that is used exclusively in OMRequests.booleanvalidateOptimisticRead(long stamp)
-
Method Details
-
tryReadLock
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
- 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
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
A wrapper around tryWriteLock() that throws when timed out.- Returns:
- stamp
- Throws:
IOException
-
tryWriteLockInOMRequest
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 inOMMultiTenantManagerImpl.AuthorizerOp.
-