scone.util
Class ServiceThread

java.lang.Object
  extended by java.lang.Thread
      extended by scone.util.ServiceThread
All Implemented Interfaces:
java.lang.Runnable

public abstract class ServiceThread
extends java.lang.Thread

a Thread for service tasks like cache cleaning. The Thread runs a loop that will sleep for a specified interval and then execute the doService() method. The Thread may be retired by calling the retire() method.


Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
ServiceThread(int sleepTime)
          creates a new ServiceThread.
 
Method Summary
abstract  void cleanUp()
          overwrite this method to define the clean up tasks for the end of the Thread
abstract  void doService()
          overwrite this method to define the service task of the Thread.
 void retire()
          retires the ServiceThread.
 void run()
          the run method
 
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
 

Constructor Detail

ServiceThread

public ServiceThread(int sleepTime)
creates a new ServiceThread.

Parameters:
sleepTime - the sleep interval
Method Detail

run

public void run()
the run method

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

retire

public void retire()
retires the ServiceThread. Execution will be interrupted and the cleanUp() method will be called.


doService

public abstract void doService()
overwrite this method to define the service task of the Thread.


cleanUp

public abstract void cleanUp()
overwrite this method to define the clean up tasks for the end of the Thread