org.jwarp.service.threadpool
Class PooledThread

java.lang.Object
  |
  +--java.lang.Thread
        |
        +--org.jwarp.service.threadpool.PooledThread
All Implemented Interfaces:
java.lang.Runnable

public class PooledThread
extends java.lang.Thread

Thread that is used in the ThreadPool.

Author:
Anatole Tresch

Fields inherited from class java.lang.Thread
inheritableThreadLocals, MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY, threadLocals
 
Constructor Summary
PooledThread()
          Creates a PooledThread.
PooledThread(java.lang.String threadName)
          Creates a PooledThread and gives the thread a name.
 
Method Summary
 void resumeThread()
          This stops the thread after the current runnable has executed by setting the running flag to false;
 void run()
          Main loop of the thread.
 void setWorkQueue(WorkQueue workQueue)
          Sets the work queue of this thread.
 void stopThread()
          This stops the thread after the current runnable has executed by setting the running flag to false;
 void suspendThread()
          This stops the thread after the current runnable has executed by setting the running flag to false;
 
Methods inherited from class java.lang.Thread
, activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, 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

PooledThread

public PooledThread()
Creates a PooledThread.

PooledThread

public PooledThread(java.lang.String threadName)
Creates a PooledThread and gives the thread a name.
Parameters:
threadName - the name of the thread
Method Detail

setWorkQueue

public final void setWorkQueue(WorkQueue workQueue)
Sets the work queue of this thread. This is normally the thread pools work wueue containing the registrated runnables.
Parameters:
workQueue - The wirk queue

stopThread

public final void stopThread()
This stops the thread after the current runnable has executed by setting the running flag to false;

resumeThread

public final void resumeThread()
This stops the thread after the current runnable has executed by setting the running flag to false;

suspendThread

public final void suspendThread()
This stops the thread after the current runnable has executed by setting the running flag to false;

run

public final void run()
Main loop of the thread. This loop keeps the thread alive and waits for work to appear in the queue. As soon as this thread get any work to do, he calls the doWork() method of the work object. When this method returns, the thread goes back to wait for another work object.
Overrides:
run in class java.lang.Thread

©   O R C A   S y s t e m s