com.splout.db.common
Class HeartBeater

java.lang.Object
  extended by java.lang.Thread
      extended by com.splout.db.common.HeartBeater
All Implemented Interfaces:
java.lang.Runnable

public class HeartBeater
extends java.lang.Thread

A Heart Beater mostly inspired by the one in SolrOutputFormat PATCH


Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
static org.apache.commons.logging.Log LOG
           
static java.lang.String WAIT_TIME_CONF
           
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
HeartBeater(org.apache.hadoop.util.Progressable progress, long waitTimeMs)
          Create the heart beat object thread set it to daemon priority and start the thread.
 
Method Summary
 void cancelHeartBeat()
          inform the background thread that this heartbeat request is not needed.
 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(java.lang.String status)
           
 
Methods inherited from class java.lang.Thread
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
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

LOG

public static org.apache.commons.logging.Log LOG

WAIT_TIME_CONF

public static final java.lang.String WAIT_TIME_CONF
See Also:
Constant Field Values
Constructor Detail

HeartBeater

public HeartBeater(org.apache.hadoop.util.Progressable progress,
                   long waitTimeMs)
Create the heart beat object thread set it to daemon priority and start the thread. When the count in threadsNeedingHeartBeat is positive, the heart beat will be issued on the progress object ever 5 seconds.

Method Detail

getProgress

public org.apache.hadoop.util.Progressable getProgress()

setProgress

public void setProgress(org.apache.hadoop.util.Progressable progress)

run

public void run()
Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread

needHeartBeat

public void needHeartBeat()
inform the background thread that heartbeats are to be issued. Issue a heart beat also


cancelHeartBeat

public void cancelHeartBeat()
inform the background thread that this heartbeat request is not needed. This must be called at some point after each needHeartBeat() request.


setStatus

public void setStatus(java.lang.String status)


Copyright © 2012-2013 Datasalt Systems S.L.. All Rights Reserved.