HAServiceProtocol (Apache Hadoop Main 3.5.0 API)
Description: declaration: package: org.apache.hadoop.ha, interface: HAServiceProtocol

Package org.apache.hadoop.ha

# Interface HAServiceProtocol

@Public @Evolving public interface HAServiceProtocol
Protocol interface that provides High Availability related primitives to monitor and fail-over the service. This interface could be used by HA frameworks to manage the service.

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Interface
  Description
  `static enum`
  `HAServiceProtocol.HAServiceState`
  An HA service may be in active or standby state.
  `static enum`
  `HAServiceProtocol.RequestSource`
  `static class`
  `org.apache.hadoop.ha.HAServiceProtocol.StateChangeRequestInfo`
  Information describing the source for a request to change state.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final long`
  `versionID`
  Initial version of the protocol

- ## Method Summary

  Modifier and Type
  Method
  Description
  `org.apache.hadoop.ha.HAServiceStatus`
  `getServiceStatus()`
  Return the current status of the service.
  `void`
  `monitorHealth()`
  Monitor the health of service.
  `void`
  `transitionToActive(org.apache.hadoop.ha.HAServiceProtocol.StateChangeRequestInfo reqInfo)`
  Request service to transition to active state.
  `void`
  `transitionToObserver(org.apache.hadoop.ha.HAServiceProtocol.StateChangeRequestInfo reqInfo)`
  Request service to transition to observer state.
  `void`
  `transitionToStandby(org.apache.hadoop.ha.HAServiceProtocol.StateChangeRequestInfo reqInfo)`
  Request service to transition to standby state.

- ## Field Details

  - ### versionID

    static final long versionID
    Initial version of the protocol
    See Also:
      - Constant Field Values

- ## Method Details

  - ### monitorHealth

    void monitorHealth() throws HealthCheckFailedException, AccessControlException, IOException
    Monitor the health of service. This periodically called by the HA frameworks to monitor the health of the service. Service is expected to perform checks to ensure it is functional. If the service is not healthy due to failure or partial failure, it is expected to throw `HealthCheckFailedException`. The definition of service not healthy is left to the service. Note that when health check of an Active service fails, failover to standby may be done.
    Throws:
      `HealthCheckFailedException` - if the health check of a service fails.
      `AccessControlException` - if access is denied.
      `IOException` - if other errors happen

  - ### transitionToActive

    void transitionToActive(org.apache.hadoop.ha.HAServiceProtocol.StateChangeRequestInfo reqInfo) throws ServiceFailedException, AccessControlException, IOException
    Request service to transition to active state. No operation, if the service is already in active state.
    Parameters:
      `reqInfo` - reqInfo.
    Throws:
      `ServiceFailedException` - if transition from standby to active fails.
      `AccessControlException` - if access is denied.
      `IOException` - if other errors happen

  - ### transitionToStandby

    void transitionToStandby(org.apache.hadoop.ha.HAServiceProtocol.StateChangeRequestInfo reqInfo) throws ServiceFailedException, AccessControlException, IOException
    Request service to transition to standby state. No operation, if the service is already in standby state.
    Parameters:
      `reqInfo` - reqInfo.
    Throws:
      `ServiceFailedException` - if transition from active to standby fails.
      `AccessControlException` - if access is denied.
      `IOException` - if other errors happen

  - ### transitionToObserver

    void transitionToObserver(org.apache.hadoop.ha.HAServiceProtocol.StateChangeRequestInfo reqInfo) throws ServiceFailedException, AccessControlException, IOException
    Request service to transition to observer state. No operation, if the service is already in observer state.
    Parameters:
      `reqInfo` - reqInfo.
    Throws:
      `ServiceFailedException` - if transition from standby to observer fails.
      `AccessControlException` - if access is denied.
      `IOException` - if other errors happen

  - ### getServiceStatus

    org.apache.hadoop.ha.HAServiceStatus getServiceStatus() throws AccessControlException, IOException
    Return the current status of the service. The status indicates the current state (e.g ACTIVE/STANDBY) as well as some additional information.
    Returns:
      HAServiceStatus.
    Throws:
      `AccessControlException` - if access is denied.
      `IOException` - if other errors happen
    See Also:
      - `HAServiceStatus`