WorkerThreadImplpublic class WorkerThreadImpl extends Thread implements WorkerThreadSimple worker thread used for processing HTTP requests. All threads are
synchronized using a Pipeline object |
Fields Summary |
---|
protected Runnable | targetWhat will be run. | protected ByteBuffer | byteBufferThe ByteBuffer used when Task are executed. | protected Pipeline | pipelineThe Pipeline on which this thread synchronize. | protected volatile boolean | doTaskLooing variable. | protected static final ThreadGroup | threadGroupThe ThreadGroup used. |
Constructors Summary |
---|
public WorkerThreadImpl(ThreadGroup threadGroup, Runnable runnable)Create a Thread that will synchronizes/block on
Pipeline instance.
super(threadGroup, runnable);
setDaemon(true);
target = runnable;
| public WorkerThreadImpl(Pipeline pipeline, String name)Create a Thread that will synchronizes/block on
Pipeline instance.
super(threadGroup, name);
this.pipeline = pipeline;
setDaemon(true);
|
Methods Summary |
---|
public java.nio.ByteBuffer | getByteBuffer()Return the ByteBuffer shared this thread
return byteBuffer;
| public void | run()Execute a Task .
if ( target != null ){
target.run();
return;
}
while (doTask) {
try{
// Wait for a Task to be added to the pipeline.
Task t = pipeline.getTask();
if ( t != null){
t.run();
t = null;
}
} catch (Throwable t) {
if ( byteBuffer != null){
byteBuffer.clear();
}
SelectorThread.logger().log(Level.FINE,
"workerThread.httpException",t);
}
}
| public void | setByteBuffer(java.nio.ByteBuffer byteBuffer)Set the ByteBuffer shared this thread
this.byteBuffer = byteBuffer;
| public void | terminate()Stop this thread. If this Thread is performing atask, the task will be
completed.
doTask = false;
|
|