AbstractLivelinessMonitor (Apache Hadoop Main 3.5.0 API)
Description: declaration: package: org.apache.hadoop.yarn.util, class: AbstractLivelinessMonitor

Package org.apache.hadoop.yarn.util

# Class AbstractLivelinessMonitor<O>

java.lang.Object
org.apache.hadoop.service.AbstractService
org.apache.hadoop.yarn.util.AbstractLivelinessMonitor<O>

All Implemented Interfaces:
  `Closeable`, `AutoCloseable`, `Service`

@Public @Evolving public abstract class AbstractLivelinessMonitor<O> extends AbstractService
A simple liveliness monitor with which clients can register, trust the component to monitor liveliness, get a call-back on expiry and then finally unregister.

- ## Nested Class Summary

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

  `Service.STATE`

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final int`
  `DEFAULT_EXPIRE`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `AbstractLivelinessMonitor(String name)`
  `AbstractLivelinessMonitor(String name, Clock clock)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected abstract void`
  `expire(O ob)`
  `protected long`
  `getExpireInterval(O o)`
  `void`
  `receivedPing(O ob)`
  `void`
  `register(O ob)`
  `void`
  `register(O ob, long expireTime)`
  `void`
  `resetTimer()`
  `protected void`
  `serviceStart()`
  Actions called during the INITED to STARTED transition.
  `protected void`
  `serviceStop()`
  Actions called during the transition to the STOPPED state.
  `protected void`
  `setExpireInterval(long expireInterval)`
  `protected void`
  `setMonitorInterval(long monitorInterval)`
  `protected void`
  `setResetTimeOnStart(boolean resetTimeOnStart)`
  `void`
  `unregister(O ob)`

  ### 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, serviceInit, 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

  - ### DEFAULT_EXPIRE

    public static final int DEFAULT_EXPIRE
    See Also:
      - Constant Field Values

- ## Constructor Details

  - ### AbstractLivelinessMonitor

    public AbstractLivelinessMonitor(String name, Clock clock)

  - ### AbstractLivelinessMonitor

    public AbstractLivelinessMonitor(String name)

- ## Method Details

  - ### serviceStart

    protected void serviceStart() throws Exception
    Description copied from class: `AbstractService`
    Actions called during the INITED to STARTED transition. This method will only ever be called once during the lifecycle of a specific service instance. Implementations do not need to be synchronized as the logic in `AbstractService.start()` prevents re-entrancy.
    Overrides:
      `serviceStart` in class `AbstractService`
    Throws:
      `Exception` - if needed -these will be caught, wrapped, and trigger a service stop

  - ### serviceStop

    protected void serviceStop() throws Exception
    Description copied from class: `AbstractService`
    Actions called during the transition to the STOPPED state. This method will only ever be called once during the lifecycle of a specific service instance. Implementations do not need to be synchronized as the logic in `AbstractService.stop()` prevents re-entrancy. Implementations MUST write this to be robust against failures, including checks for null references -and for the first failure to not stop other attempts to shut down parts of the service.
    Overrides:
      `serviceStop` in class `AbstractService`
    Throws:
      `Exception` - if needed -these will be caught and logged.

  - ### expire

    protected abstract void expire(O ob)

  - ### setExpireInterval

    protected void setExpireInterval(long expireInterval)

  - ### getExpireInterval

    protected long getExpireInterval(O o)

  - ### setMonitorInterval

    protected void setMonitorInterval(long monitorInterval)

  - ### receivedPing

    public void receivedPing(O ob)

  - ### register

    public void register(O ob)

  - ### register

    public void register(O ob, long expireTime)

  - ### unregister

    public void unregister(O ob)

  - ### resetTimer

    public void resetTimer()

  - ### setResetTimeOnStart

    protected void setResetTimeOnStart(boolean resetTimeOnStart)