public class HeartBeater extends Thread
threadsNeedingHeartBeat
handles the number of
threads requesting a heart beat.
The expected usage pattern is
try { heartBeater.needHeartBeat(); do something that may take a while } finally { heartBeater.cancelHeartBeat(); }
Thread.State, Thread.UncaughtExceptionHandler
Modifier and Type | Field and Description |
---|---|
static org.slf4j.Logger |
LOG |
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
Constructor and Description |
---|
HeartBeater(org.apache.hadoop.util.Progressable progress)
Create the heart beat object thread set it to daemon priority and start the
thread.
|
Modifier and Type | Method and Description |
---|---|
void |
cancelHeartBeat()
inform the background thread that this heartbeat request is not needed.
|
void |
close()
Releases any resources
|
org.apache.hadoop.util.Progressable |
getProgress() |
void |
needHeartBeat()
inform the background thread that heartbeats are to be issued.
|
void |
run() |
void |
setProgress(org.apache.hadoop.util.Progressable progress) |
void |
setStatus(String status) |
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
public HeartBeater(org.apache.hadoop.util.Progressable progress)
threadsNeedingHeartBeat
is positive, the
heart beat will be issued on the progress object every 60 seconds.public org.apache.hadoop.util.Progressable getProgress()
public void setProgress(org.apache.hadoop.util.Progressable progress)
public void needHeartBeat()
public void cancelHeartBeat()
needHeartBeat()
request.public void setStatus(String status)
public void close()
Copyright © 2000-2015 Apache Software Foundation. All Rights Reserved.