Package org.apache.hadoop.hdfs.util
Interface RwLock
- All Known Subinterfaces:
Namesystem
- All Known Implementing Classes:
FSNamesystem
public interface RwLock
Read-write lock interface for FSNamesystem.
-
Method Summary
Modifier and TypeMethodDescriptiondefault booleanCheck if the current thread holds read lock.booleanhasReadLock(RwLockMode lockMode) Check if the current thread holds read lock.default booleanCheck if the current thread holds write lock.booleanhasWriteLock(RwLockMode lockMode) Check if the current thread holds write lock.default voidreadLock()Acquire read lock.voidreadLock(RwLockMode lockMode) Acquire read lock.default voidAcquire read lock, unless interrupted while waiting.voidreadLockInterruptibly(RwLockMode lockMode) Acquire read lock, unless interrupted while waiting.default voidRelease read lock.default voidreadUnlock(String opName) Release read lock with operation name.voidreadUnlock(RwLockMode lockMode, String opName) Release read lock with operation name.default voidAcquire write lock.voidwriteLock(RwLockMode lockMode) Acquire write lock.default voidAcquire write lock, unless interrupted while waiting.voidwriteLockInterruptibly(RwLockMode lockMode) Acquire write lock, unless interrupted while waiting.default voidRelease write lock.default voidwriteUnlock(String opName) Release write lock with operation name.voidwriteUnlock(RwLockMode lockMode, String opName) Release write lock with operation name.
-
Method Details
-
readLock
default void readLock()Acquire read lock. -
readLock
Acquire read lock.- Parameters:
lockMode- The lock type for acquiring a read lock
-
readLockInterruptibly
Acquire read lock, unless interrupted while waiting.- Throws:
InterruptedException- if the thread is interrupted
-
readLockInterruptibly
Acquire read lock, unless interrupted while waiting.- Parameters:
lockMode- The lock type for acquiring a read lock- Throws:
InterruptedException- if the thread is interrupted
-
readUnlock
default void readUnlock()Release read lock. -
readUnlock
Release read lock with operation name.- Parameters:
opName- Option name.
-
readUnlock
Release read lock with operation name.- Parameters:
lockMode- The lock type for releasing the read lockopName- Option name.
-
hasReadLock
default boolean hasReadLock()Check if the current thread holds read lock.- Returns:
- true if the read lock is held by the current thread, else false
-
hasReadLock
Check if the current thread holds read lock.- Parameters:
lockMode- The lock type used to check whether a read lock is held- Returns:
- true if the read lock is held by the current thread, else false
-
writeLock
default void writeLock()Acquire write lock. -
writeLock
Acquire write lock.- Parameters:
lockMode- The lock type for acquiring a write lock
-
writeLockInterruptibly
Acquire write lock, unless interrupted while waiting.- Throws:
InterruptedException- if the thread is interrupted
-
writeLockInterruptibly
Acquire write lock, unless interrupted while waiting.- Parameters:
lockMode- The lock type for acquiring a write lock- Throws:
InterruptedException- if the thread is interrupted
-
writeUnlock
default void writeUnlock()Release write lock. -
writeUnlock
Release write lock with operation name.- Parameters:
opName- Option name.
-
writeUnlock
Release write lock with operation name.- Parameters:
lockMode- The lock type for releasing the write lockopName- Option name.
-
hasWriteLock
default boolean hasWriteLock()Check if the current thread holds write lock.- Returns:
- true if the write lock is held by the current thread, else false
-
hasWriteLock
Check if the current thread holds write lock.- Parameters:
lockMode- The lock type used to check whether a write lock is held- Returns:
- true if the write lock is held by the current thread, else false.
-