oemware.core
Class ThreadBase

java.lang.Object
  extended by java.lang.Thread
      extended by oemware.core.ThreadBase
All Implemented Interfaces:
java.lang.Runnable
Direct Known Subclasses:
DatagramServer, SingleThread

public abstract class ThreadBase
extends java.lang.Thread

The thread base class. Extend this class for your threaded service.

Version:
$Id: ThreadBase.java 13 2008-06-15 19:43:04Z oemware $

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
protected  boolean mJoinThread
          Set this flag to join the thread before proceeding.
protected  long mJoinTimeout
           
protected  boolean mRunning
          The running flag.
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
ThreadBase()
           
 
Method Summary
protected  void afterStart()
           
protected  void afterStop()
           
protected  void beforeStart()
           
protected  void beforeStop()
           
 boolean getJoinThread()
           
 long getJoinTimeout()
           
 boolean isRunning()
           
abstract  void run()
          This must be implemented for the thread to work.
 void setJoinThread(boolean pJoinThread)
           
 void setJoinTimeout(long pJoinTimeout)
           
 void shutdown()
           
 void startup()
           
 
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

mRunning

protected volatile boolean mRunning
The running flag. This is only to be used by this thread.


mJoinThread

protected boolean mJoinThread
Set this flag to join the thread before proceeding.


mJoinTimeout

protected long mJoinTimeout
Constructor Detail

ThreadBase

public ThreadBase()
Method Detail

run

public abstract void run()
This must be implemented for the thread to work.

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

beforeStart

protected void beforeStart()
                    throws ServiceException
Throws:
ServiceException

afterStart

protected void afterStart()
                   throws ServiceException
Throws:
ServiceException

beforeStop

protected void beforeStop()
                   throws ServiceException
Throws:
ServiceException

afterStop

protected void afterStop()
                  throws ServiceException
Throws:
ServiceException

startup

public void startup()
             throws ServiceException
Throws:
ServiceException

shutdown

public void shutdown()
              throws ServiceException
Throws:
ServiceException

setJoinThread

public final void setJoinThread(boolean pJoinThread)

getJoinThread

public final boolean getJoinThread()

setJoinTimeout

public final void setJoinTimeout(long pJoinTimeout)

getJoinTimeout

public final long getJoinTimeout()

isRunning

public final boolean isRunning()


Copyright © 2008 Deft Labs - Released under LGPL, Version 3.0