com.mischiefbox.pollserve
Class ProcessorThread

java.lang.Object
  |
  +--com.mischiefbox.pollserve.ProcessorThread
All Implemented Interfaces:
Runnable

public class ProcessorThread
extends Object
implements Runnable

Defines a message processor thread.

Version:
$Id$
Author:
Chris Jones

Field Summary
protected  boolean bActive
          Indicates if this is currently in use (active).
protected  long lLastUsedMillis
          The last used time of this processor thread.
protected  Message msg
          The message to process.
protected  Queue qOutput
          The output queue which will receive message results (if any).
protected  ThreadPool tpManager
          Thread pool that manages this processor thread.
protected  Thread tProcessor
          The processor thread.
 
Constructor Summary
ProcessorThread(ThreadPool tpManager)
          Create a new processor thread.
 
Method Summary
 long getLastUsed()
          Gets the last used time.
 boolean isActive()
          Indicates if this is actively processing.
 void process(Message msg, Queue qOutput)
          Process a message.
 void run()
          Process the message and put the results (if any) on the output queue.
 void shutdown()
          Shut down the processor thread.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

tProcessor

protected Thread tProcessor
The processor thread.

msg

protected Message msg
The message to process.

qOutput

protected Queue qOutput
The output queue which will receive message results (if any).

tpManager

protected ThreadPool tpManager
Thread pool that manages this processor thread.

lLastUsedMillis

protected long lLastUsedMillis
The last used time of this processor thread.

bActive

protected boolean bActive
Indicates if this is currently in use (active).
Constructor Detail

ProcessorThread

public ProcessorThread(ThreadPool tpManager)
Create a new processor thread.
Method Detail

process

public void process(Message msg,
                    Queue qOutput)
Process a message.
Parameters:
msg - the message to process.
qOutput - the output that will receive message results.

run

public void run()
Process the message and put the results (if any) on the output queue.
Specified by:
run in interface Runnable

shutdown

public void shutdown()
Shut down the processor thread.

isActive

public boolean isActive()
Indicates if this is actively processing.
Returns:
true if this is active, false otherwise.

getLastUsed

public long getLastUsed()
Gets the last used time.
Returns:
the last used time (in milliseconds).


Copyright © 2001 by Christopher R. Jones. All Rights Reserved.