Class NodeHealthCheckerService

java.lang.Object
org.apache.hadoop.service.AbstractService
org.apache.hadoop.service.CompositeService
org.apache.hadoop.yarn.server.nodemanager.health.NodeHealthCheckerService
All Implemented Interfaces:
Closeable, AutoCloseable, org.apache.hadoop.service.Service, HealthReporter

public class NodeHealthCheckerService extends org.apache.hadoop.service.CompositeService implements HealthReporter
This class provides functionality of checking the health of a node and reporting back to the service for which the health checker has been asked to report. It is a CompositeService: every Service must be registered first in serviceInit, and should also implement the HealthReporter interface - otherwise an exception is thrown. Calling functions of HealthReporter merge its dependent services' reports.
See Also:
  • Nested Class Summary

    Nested classes/interfaces inherited from class org.apache.hadoop.service.CompositeService

    org.apache.hadoop.service.CompositeService.CompositeServiceShutdownHook

    Nested classes/interfaces inherited from interface org.apache.hadoop.service.Service

    org.apache.hadoop.service.Service.STATE
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final org.slf4j.Logger
     
    static final String
     

    Fields inherited from class org.apache.hadoop.service.CompositeService

    STOP_ONLY_STARTED_SERVICES
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
     
    Joining the health reports of the dependent services.
    long
    Returns time stamp when node health check was last run.
    boolean
    Gets whether the node is healthy or not.
    void
    Propagating an exception to ExceptionReporter.
    protected void
    serviceInit(org.apache.hadoop.conf.Configuration conf)
     

    Methods inherited from class org.apache.hadoop.service.CompositeService

    addIfService, addService, getServices, removeService, serviceStart, serviceStop

    Methods inherited from class org.apache.hadoop.service.AbstractService

    close, getBlockers, getConfig, getFailureCause, getFailureState, getLifecycleHistory, getName, getServiceState, getStartTime, init, isInState, noteFailure, putBlocker, registerGlobalListener, registerServiceListener, removeBlocker, setConfig, start, stop, toString, unregisterGlobalListener, unregisterServiceListener, waitForServiceToStop

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

  • Constructor Details

  • Method Details

    • serviceInit

      protected void serviceInit(org.apache.hadoop.conf.Configuration conf) throws Exception
      Overrides:
      serviceInit in class org.apache.hadoop.service.CompositeService
      Throws:
      Exception
    • getHealthReport

      public String getHealthReport()
      Joining the health reports of the dependent services.
      Specified by:
      getHealthReport in interface HealthReporter
      Returns:
      the report string about the health of the node
    • isHealthy

      public boolean isHealthy()
      Description copied from interface: HealthReporter
      Gets whether the node is healthy or not.
      Specified by:
      isHealthy in interface HealthReporter
      Returns:
      true if the node is healthy
    • getLastHealthReportTime

      public long getLastHealthReportTime()
      Description copied from interface: HealthReporter
      Returns time stamp when node health check was last run.
      Specified by:
      getLastHealthReportTime in interface HealthReporter
      Returns:
      when the last time the node health status is reported
    • getDiskHandler

      public LocalDirsHandlerService getDiskHandler()
      Returns:
      the disk handler
    • reportException

      public void reportException(Exception exception)
      Propagating an exception to ExceptionReporter.
      Parameters:
      exception - the exception to propagate