Interface RwLock

All Known Subinterfaces:
Namesystem
All Known Implementing Classes:
FSNamesystem

public interface RwLock
Read-write lock interface for FSNamesystem.
  • Method Details

    • readLock

      default void readLock()
      Acquire read lock.
    • readLock

      void readLock(RwLockMode lockMode)
      Acquire read lock.
      Parameters:
      lockMode - The lock type for acquiring a read lock
    • readLockInterruptibly

      default void readLockInterruptibly() throws InterruptedException
      Acquire read lock, unless interrupted while waiting.
      Throws:
      InterruptedException - if the thread is interrupted
    • readLockInterruptibly

      void readLockInterruptibly(RwLockMode lockMode) throws InterruptedException
      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

      default void readUnlock(String opName)
      Release read lock with operation name.
      Parameters:
      opName - Option name.
    • readUnlock

      void readUnlock(RwLockMode lockMode, String opName)
      Release read lock with operation name.
      Parameters:
      lockMode - The lock type for releasing the read lock
      opName - 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

      boolean hasReadLock(RwLockMode lockMode)
      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

      void writeLock(RwLockMode lockMode)
      Acquire write lock.
      Parameters:
      lockMode - The lock type for acquiring a write lock
    • writeLockInterruptibly

      default void writeLockInterruptibly() throws InterruptedException
      Acquire write lock, unless interrupted while waiting.
      Throws:
      InterruptedException - if the thread is interrupted
    • writeLockInterruptibly

      void writeLockInterruptibly(RwLockMode lockMode) throws InterruptedException
      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

      default void writeUnlock(String opName)
      Release write lock with operation name.
      Parameters:
      opName - Option name.
    • writeUnlock

      void writeUnlock(RwLockMode lockMode, String opName)
      Release write lock with operation name.
      Parameters:
      lockMode - The lock type for releasing the write lock
      opName - 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

      boolean hasWriteLock(RwLockMode lockMode)
      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.