com.mischiefbox.dmud.util
Class ProcessorThread

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

public class ProcessorThread
extends Object
implements Runnable

Defines a message processor thread.

Version:
$Id: ProcessorThread.java,v 1.1.1.1 2001/06/27 01:33:17 cjones Exp $
Author:
Chris Jones

Field Summary
protected  boolean bActive
          Indicates if this is currently in use (active).
protected  boolean bProcessing
          Indicates if this is processing (thread started).
protected  long lLastUsedMillis
          The last used time of this processor thread.
protected  long lShutdownMillis
          The time when this will be idle too long and be shut down automatically.
protected  Message msg
          The message to process.
protected  PythonInterpreter pyInterp
          The processor thread's python interpreter.
protected  Queue qInput
          The input queue with new messages to be processed.
protected  Queue qOutput
          The output queue that will receive messages processed by this thread.
protected  int SLEEP_MILLIS
          Idle thread sleep time (between waking up to check status).
protected  ThreadGroup tgManager
          The thread group that contains this processor thread.
protected  Thread tProcessor
          The processor thread.
 
Constructor Summary
ProcessorThread(ThreadGroup tgManager, Queue qInput, Queue qOutput)
          Create a new processor thread.
 
Method Summary
 long getLastUsed()
          Gets the last used time.
 boolean isActive()
          Indicates if this is actively processing.
 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

SLEEP_MILLIS

protected int SLEEP_MILLIS
Idle thread sleep time (between waking up to check status).

tProcessor

protected Thread tProcessor
The processor thread.

msg

protected Message msg
The message to process.

lLastUsedMillis

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

lShutdownMillis

protected long lShutdownMillis
The time when this will be idle too long and be shut down automatically.

bActive

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

bProcessing

protected boolean bProcessing
Indicates if this is processing (thread started).

pyInterp

protected PythonInterpreter pyInterp
The processor thread's python interpreter.

qInput

protected Queue qInput
The input queue with new messages to be processed.

qOutput

protected Queue qOutput
The output queue that will receive messages processed by this thread.

tgManager

protected ThreadGroup tgManager
The thread group that contains this processor thread.
Constructor Detail

ProcessorThread

public ProcessorThread(ThreadGroup tgManager,
                       Queue qInput,
                       Queue qOutput)
Create a new processor thread.
Parameters:
tgManager - the thread group that owns this thread.
qInput - the input queue on which new messages are found.
qOutput - the output queue which received processed messages.
Method Detail

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.