org.sandev.TaskHeap.ExternalSync
Class PollingThread

java.lang.Object
  extended by java.lang.Thread
      extended by org.sandev.TaskHeap.ExternalSync.PollingThread
All Implemented Interfaces:
java.lang.Runnable

public class PollingThread
extends java.lang.Thread

A polling thread to periodically check for ExternalPlans that need their time estimations updated.


Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
protected static int MAXPAGESIZE
          The maximum query size used for paged query retrieval.
protected  ExternalSyncNode node
          Back reference to our parent ExternalSyncNode.
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
PollingThread(ExternalSyncNode node)
          Ctor sets the required back reference to the node.
 
Method Summary
protected  void clearCache()
          Clear the cache, dump the current memory stats and email them to support.
protected  void doPeriodicTasks()
          Do our periodic checking tasks.
protected  void error(java.lang.String text)
          Dump out the given error text to the log.
protected  void info(java.lang.String text)
          Dump out the given informational text to the log.
protected  boolean isUpToDate(ExternalPlan ep)
          Return true if this plan has been checked recently enough, false otherwise.
protected  java.lang.String planstr(ExternalPlan ep)
          Return a shorthand summary string of this external plan.
 void run()
          Control loop for work to be done.
protected  void updateExternalPlans()
          Fetch the external plans and update any that need it.
 
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

MAXPAGESIZE

protected static final int MAXPAGESIZE
The maximum query size used for paged query retrieval.

See Also:
Constant Field Values

node

protected ExternalSyncNode node
Back reference to our parent ExternalSyncNode.

Constructor Detail

PollingThread

public PollingThread(ExternalSyncNode node)
Ctor sets the required back reference to the node.

Method Detail

run

public void run()
Control loop for work to be done.

Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread

doPeriodicTasks

protected void doPeriodicTasks()
                        throws org.sandev.basics.structs.SandException
Do our periodic checking tasks. To keep this simple each task does its own checking to see if it needs to run.

Throws:
org.sandev.basics.structs.SandException

clearCache

protected void clearCache()
Clear the cache, dump the current memory stats and email them to support.


updateExternalPlans

protected void updateExternalPlans()
                            throws org.sandev.basics.structs.SandException
Fetch the external plans and update any that need it.

Throws:
org.sandev.basics.structs.SandException

isUpToDate

protected boolean isUpToDate(ExternalPlan ep)
Return true if this plan has been checked recently enough, false otherwise.


planstr

protected java.lang.String planstr(ExternalPlan ep)
Return a shorthand summary string of this external plan.


info

protected void info(java.lang.String text)
Dump out the given informational text to the log. Prepend an indentifying prefix so we know it is coming from this thread.


error

protected void error(java.lang.String text)
Dump out the given error text to the log. Prepend an indentifying prefix so we know it is coming from this thread.