Class HealthMonitor

java.lang.Object
org.apache.hadoop.ha.HealthMonitor

@Private public class HealthMonitor extends Object
This class is a daemon which runs in a loop, periodically heartbeating with an HA service. It is responsible for keeping track of that service's health and exposing callbacks to the failover controller when the health status changes. Classes which need callbacks should implement the HealthMonitor.Callback interface.
  • Method Details

    • addCallback

      public void addCallback(org.apache.hadoop.ha.HealthMonitor.Callback cb)
    • addServiceStateCallback

      public void addServiceStateCallback(org.apache.hadoop.ha.HealthMonitor.ServiceStateCallback cb)
    • shutdown

      public void shutdown()
    • getProxy

      public HAServiceProtocol getProxy()
      Returns:
      the current proxy object to the underlying service. Note that this may return null in the case that the service is not responding. Also note that, even if the last indicated state is healthy, the service may have gone down in the meantime.
    • createProxy

      protected HAServiceProtocol createProxy() throws IOException
      Connect to the service to be monitored. Stubbed out for easier testing.
      Returns:
      HAServiceProtocol.
      Throws:
      IOException - raised on errors performing I/O.