RwLock (Apache Hadoop HDFS 3.5.0 API)
Description: declaration: package: org.apache.hadoop.hdfs.util, interface: RwLock

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 Type
  Method
  Description
  `default boolean`
  `hasReadLock()`
  Check if the current thread holds read lock.
  `boolean`
  `hasReadLock(RwLockMode lockMode)`
  Check if the current thread holds read lock.
  `default boolean`
  `hasWriteLock()`
  Check if the current thread holds write lock.
  `boolean`
  `hasWriteLock(RwLockMode lockMode)`
  Check if the current thread holds write lock.
  `default void`
  `readLock()`
  Acquire read lock.
  `void`
  `readLock(RwLockMode lockMode)`
  Acquire read lock.
  `default void`
  `readLockInterruptibly()`
  Acquire read lock, unless interrupted while waiting.
  `void`
  `readLockInterruptibly(RwLockMode lockMode)`
  Acquire read lock, unless interrupted while waiting.
  `default void`
  `readUnlock()`
  Release read lock.
  `default void`
  `readUnlock(String opName)`
  Release read lock with operation name.
  `void`
  `readUnlock(RwLockMode lockMode, String opName)`
  Release read lock with operation name.
  `default void`
  `writeLock()`
  Acquire write lock.
  `void`
  `writeLock(RwLockMode lockMode)`
  Acquire write lock.
  `default void`
  `writeLockInterruptibly()`
  Acquire write lock, unless interrupted while waiting.
  `void`
  `writeLockInterruptibly(RwLockMode lockMode)`
  Acquire write lock, unless interrupted while waiting.
  `default void`
  `writeUnlock()`
  Release write lock.
  `default void`
  `writeUnlock(String opName)`
  Release write lock with operation name.
  `void`
  `writeUnlock(RwLockMode lockMode, String opName)`
  Release write lock with operation name.

- ## 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.