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
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 -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract voidprotected longvoidreceivedPing(O ob) voidvoidvoidprotected voidActions called during the INITED to STARTED transition.protected voidActions called during the transition to the STOPPED state.protected voidsetExpireInterval(long expireInterval) protected voidsetMonitorInterval(long monitorInterval) protected voidsetResetTimeOnStart(boolean resetTimeOnStart) voidunregister(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
-
Field Details
-
DEFAULT_EXPIRE
public static final int DEFAULT_EXPIRE- See Also:
-
-
Constructor Details
-
AbstractLivelinessMonitor
-
AbstractLivelinessMonitor
-
-
Method Details
-
serviceStart
Description copied from class:AbstractServiceActions 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 inAbstractService.start()prevents re-entrancy.- Overrides:
serviceStartin classAbstractService- Throws:
Exception- if needed -these will be caught, wrapped, and trigger a service stop
-
serviceStop
Description copied from class:AbstractServiceActions 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 inAbstractService.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:
serviceStopin classAbstractService- Throws:
Exception- if needed -these will be caught and logged.
-
expire
-
setExpireInterval
protected void setExpireInterval(long expireInterval) -
getExpireInterval
-
setMonitorInterval
protected void setMonitorInterval(long monitorInterval) -
receivedPing
-
register
-
register
-
unregister
-
resetTimer
public void resetTimer() -
setResetTimeOnStart
protected void setResetTimeOnStart(boolean resetTimeOnStart)
-