public class NodeHealthScriptRunner extends AbstractService
Service.STATE
Modifier and Type | Field and Description |
---|---|
static String |
NODE_HEALTH_SCRIPT_TIMED_OUT_MSG
Time out error message
|
Constructor and Description |
---|
NodeHealthScriptRunner(String scriptName,
long chkInterval,
long timeout,
String[] scriptArgs) |
Modifier and Type | Method and Description |
---|---|
String |
getHealthReport()
Returns output from health script.
|
long |
getLastReportedTime()
Returns time stamp when node health script was last run.
|
TimerTask |
getTimerTask()
Used only by tests to access the timer task directly
|
boolean |
isHealthy()
Gets the if the node is healthy or not
|
protected void |
serviceInit(Configuration conf)
All initialization code needed by a service.
|
protected void |
serviceStart()
Method used to start the Node health monitoring.
|
protected void |
serviceStop()
Method used to terminate the node health monitoring service.
|
static boolean |
shouldRun(String healthScript)
Method used to determine if or not node health monitoring service should be
started or not.
|
close, getBlockers, getConfig, getFailureCause, getFailureState, getLifecycleHistory, getName, getServiceState, getStartTime, init, isInState, noteFailure, putBlocker, registerGlobalListener, registerServiceListener, removeBlocker, setConfig, start, stop, toString, unregisterGlobalListener, unregisterServiceListener, waitForServiceToStop
public static final String NODE_HEALTH_SCRIPT_TIMED_OUT_MSG
public NodeHealthScriptRunner(String scriptName, long chkInterval, long timeout, String[] scriptArgs)
protected void serviceInit(Configuration conf) throws Exception
AbstractService
AbstractService.init(Configuration)
prevents re-entrancy.
The base implementation checks to see if the subclass has created
a new configuration instance, and if so, updates the base class valueserviceInit
in class AbstractService
conf
- configurationException
- on a failure -these will be caught,
possibly wrapped, and wil; trigger a service stopprotected void serviceStart() throws Exception
serviceStart
in class AbstractService
Exception
- if needed -these will be caught,
wrapped, and trigger a service stopprotected void serviceStop()
serviceStop
in class AbstractService
public boolean isHealthy()
public String getHealthReport()
public long getLastReportedTime()
public static boolean shouldRun(String healthScript)
public TimerTask getTimerTask()
Copyright © 2017 Apache Software Foundation. All Rights Reserved.