org.starhope.appius.util
Class DataRecordFlushThread

java.lang.Object
  extended by java.lang.Thread
      extended by org.starhope.appius.util.DataRecordFlushThread
All Implemented Interfaces:
Runnable

public class DataRecordFlushThread
extends Thread

Perform asynchronous background flushes of data records that were updated at some point, but haven't been written to the database server yet — this process is designed to ensure that a flurry of data record changes don't result in a massive surge of database writes as well, as the likelihood is that the entire series of changes will be written at a go.

Author:
brpocock@star-hope.org

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
 
Field Summary
private  long lastPingTime
          The last time this thread was “pinged.”
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
DataRecordFlushThread()
          WRITEME: Document this constructor brpocock@star-hope.org
 
Method Summary
 void ping()
          Keep the thread running for a while longer.
 void run()
           
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, 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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

lastPingTime

private long lastPingTime
The last time this thread was “pinged.”

Constructor Detail

DataRecordFlushThread

public DataRecordFlushThread()
WRITEME: Document this constructor brpocock@star-hope.org

Method Detail

ping

public void ping()
Keep the thread running for a while longer. The thread will exit “a while” after the last ping (configurable as org.starhope.appius.dataFlushThread.pingLatency, default 30000 ms = 30 s)


run

public void run()
Specified by:
run in interface Runnable
Overrides:
run in class Thread
See Also:
Thread.run()