NameNode.NameNodeHAContext (Apache Hadoop HDFS 3.5.0 API)
Description: declaration: package: org.apache.hadoop.hdfs.server.namenode, class: NameNode, class: NameNodeHAContext

Package org.apache.hadoop.hdfs.server.namenode

# Class NameNode.NameNodeHAContext

java.lang.Object
org.apache.hadoop.hdfs.server.namenode.NameNode.NameNodeHAContext

All Implemented Interfaces:
  `HAContext`

Enclosing class:
  NameNode

protected class NameNode.NameNodeHAContext extends Object implements HAContext
Class used to expose `NameNode` as context to `HAState`

- ## Constructor Summary

  Constructors
  Modifier
  Constructor
  Description
  `protected`
  `NameNodeHAContext()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `allowStaleReads()`
  `void`
  `checkOperation(NameNode.OperationCategory op)`
  Check if an operation of given category is allowed
  `HAState`
  `getState()`
  Get the state from the context
  `void`
  `prepareToStopStandbyServices()`
  Prepare to exit the standby state
  `void`
  `setState(HAState s)`
  Set the state of the context to given `state`
  `void`
  `startActiveServices()`
  Start the services required in active state
  `void`
  `startStandbyServices()`
  Start the services required in standby state
  `void`
  `stopActiveServices()`
  Stop the services when exiting active state
  `void`
  `stopStandbyServices()`
  Stop the services when exiting standby state
  `void`
  `writeLock()`
  Take a write-lock on the underlying namesystem so that no concurrent state transitions or edits can be made.
  `void`
  `writeUnlock()`
  Unlock the lock taken by `HAContext.writeLock()`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### NameNodeHAContext

    protected NameNodeHAContext()

- ## Method Details

  - ### setState

    public void setState(HAState s)
    Description copied from interface: `HAContext`
    Set the state of the context to given `state`
    Specified by:
      `setState` in interface `HAContext`

  - ### getState

    public HAState getState()
    Description copied from interface: `HAContext`
    Get the state from the context
    Specified by:
      `getState` in interface `HAContext`

  - ### startActiveServices

    public void startActiveServices() throws IOException
    Description copied from interface: `HAContext`
    Start the services required in active state
    Specified by:
      `startActiveServices` in interface `HAContext`
    Throws:
      `IOException`

  - ### stopActiveServices

    public void stopActiveServices() throws IOException
    Description copied from interface: `HAContext`
    Stop the services when exiting active state
    Specified by:
      `stopActiveServices` in interface `HAContext`
    Throws:
      `IOException`

  - ### startStandbyServices

    public void startStandbyServices() throws IOException
    Description copied from interface: `HAContext`
    Start the services required in standby state
    Specified by:
      `startStandbyServices` in interface `HAContext`
    Throws:
      `IOException`

  - ### prepareToStopStandbyServices

    public void prepareToStopStandbyServices() throws org.apache.hadoop.ha.ServiceFailedException
    Description copied from interface: `HAContext`
    Prepare to exit the standby state
    Specified by:
      `prepareToStopStandbyServices` in interface `HAContext`
    Throws:
      `org.apache.hadoop.ha.ServiceFailedException`

  - ### stopStandbyServices

    public void stopStandbyServices() throws IOException
    Description copied from interface: `HAContext`
    Stop the services when exiting standby state
    Specified by:
      `stopStandbyServices` in interface `HAContext`
    Throws:
      `IOException`

  - ### writeLock

    public void writeLock()
    Description copied from interface: `HAContext`
    Take a write-lock on the underlying namesystem so that no concurrent state transitions or edits can be made.
    Specified by:
      `writeLock` in interface `HAContext`

  - ### writeUnlock

    public void writeUnlock()
    Description copied from interface: `HAContext`
    Unlock the lock taken by `HAContext.writeLock()`
    Specified by:
      `writeUnlock` in interface `HAContext`

  - ### checkOperation

    public void checkOperation(NameNode.OperationCategory op) throws org.apache.hadoop.ipc.StandbyException
    Check if an operation of given category is allowed
    Specified by:
      `checkOperation` in interface `HAContext`
    Throws:
      `org.apache.hadoop.ipc.StandbyException`

  - ### allowStaleReads

    public boolean allowStaleReads()
    Specified by:
      `allowStaleReads` in interface `HAContext`
    Returns:
      true if the node should allow stale reads (ie reads while the namespace is not up to date)