com.sun.grizzly.util
Class WorkerThread

java.lang.Object
  extended by java.lang.Thread
      extended by com.sun.grizzly.util.WorkerThread
All Implemented Interfaces:
Runnable
Direct Known Subclasses:
WorkerThreadImpl

public abstract class WorkerThread
extends Thread

Simple interface to allow the addition of Thread attributes.

Author:
Jean-Francois Arcand

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
 
Field Summary
protected  ByteBuffer byteBuffer
          The ByteBuffer used when Task are executed.
protected  ByteBuffer inputBB
          The encrypted ByteBuffer used for handshaking and reading request bytes.
protected  ByteBuffer outputBB
          The encrypted ByteBuffer used for handshaking and writing response bytes.
protected  SSLEngine sslEngine
          TheSSLEngine used to manage the SSL over NIO request.
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
WorkerThread()
           
WorkerThread(Runnable target)
           
WorkerThread(Runnable target, String name)
           
WorkerThread(String name)
           
WorkerThread(ThreadGroup group, Runnable target)
           
WorkerThread(ThreadGroup group, Runnable target, String name)
           
WorkerThread(ThreadGroup group, Runnable target, String name, long stackSize)
           
WorkerThread(ThreadGroup group, String name)
           
 
Method Summary
abstract  void attach(ThreadAttachment threadAttachment)
          Attach the ThreadAttachment to this instance.
abstract  ThreadAttachment detach()
          Detach the current set of attributes (state) associated with this instance.
abstract  ThreadAttachment getAttachment()
          Get the current set of attributes (state) associated with this instance.
 ByteBuffer getByteBuffer()
          Return the ByteBuffer shared this thread
 ByteBuffer getInputBB()
          Return the encrypted ByteBuffer used to handle request.
 ByteBuffer getOutputBB()
          Return the encrypted ByteBuffer used to handle response.
 SSLEngine getSSLEngine()
          Set theSSLEngine.
 void reset()
           
 void setByteBuffer(ByteBuffer byteBuffer)
          Set the ByteBuffer shared this thread
 void setInputBB(ByteBuffer inputBB)
          Set the encrypted ByteBuffer used to handle request.
 void setOutputBB(ByteBuffer outputBB)
          Set the encrypted ByteBuffer used to handle response.
 void setSSLEngine(SSLEngine sslEngine)
          Get theSSLEngine.
abstract  ThreadAttachment updateAttachment(int mode)
          Updates Thread associated attachment according to the passed mode.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, 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, run, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

byteBuffer

protected ByteBuffer byteBuffer
The ByteBuffer used when Task are executed.


inputBB

protected ByteBuffer inputBB
The encrypted ByteBuffer used for handshaking and reading request bytes.


outputBB

protected ByteBuffer outputBB
The encrypted ByteBuffer used for handshaking and writing response bytes.


sslEngine

protected SSLEngine sslEngine
TheSSLEngine used to manage the SSL over NIO request.

Constructor Detail

WorkerThread

public WorkerThread()

WorkerThread

public WorkerThread(String name)

WorkerThread

public WorkerThread(Runnable target)

WorkerThread

public WorkerThread(Runnable target,
                    String name)

WorkerThread

public WorkerThread(ThreadGroup group,
                    String name)

WorkerThread

public WorkerThread(ThreadGroup group,
                    Runnable target)

WorkerThread

public WorkerThread(ThreadGroup group,
                    Runnable target,
                    String name)

WorkerThread

public WorkerThread(ThreadGroup group,
                    Runnable target,
                    String name,
                    long stackSize)
Method Detail

setByteBuffer

public void setByteBuffer(ByteBuffer byteBuffer)
Set the ByteBuffer shared this thread


getByteBuffer

public ByteBuffer getByteBuffer()
Return the ByteBuffer shared this thread


getInputBB

public ByteBuffer getInputBB()
Return the encrypted ByteBuffer used to handle request.

Returns:
ByteBuffer

setInputBB

public void setInputBB(ByteBuffer inputBB)
Set the encrypted ByteBuffer used to handle request.

Parameters:
inputBB - ByteBuffer

getOutputBB

public ByteBuffer getOutputBB()
Return the encrypted ByteBuffer used to handle response.

Returns:
ByteBuffer

setOutputBB

public void setOutputBB(ByteBuffer outputBB)
Set the encrypted ByteBuffer used to handle response.

Parameters:
outputBB - ByteBuffer

getSSLEngine

public SSLEngine getSSLEngine()
Set theSSLEngine.


setSSLEngine

public void setSSLEngine(SSLEngine sslEngine)
Get theSSLEngine.

Parameters:
sslEngine{@link - SSLEngine}

updateAttachment

public abstract ThreadAttachment updateAttachment(int mode)
Updates Thread associated attachment according to the passed mode.

Returns:
updated ThreadAttachment

getAttachment

public abstract ThreadAttachment getAttachment()
Get the current set of attributes (state) associated with this instance. Unlike detach(), this method doesn't clear the WorkerThread attributes.

Returns:
the Thread associated ThreadAttachment

detach

public abstract ThreadAttachment detach()
Detach the current set of attributes (state) associated with this instance. Method will re-create all the ByteBuffers associated with this thread.

Returns:
a new ThreadAttachment

attach

public abstract void attach(ThreadAttachment threadAttachment)
Attach the ThreadAttachment to this instance. This will configure this Thread attributes like ByteBuffer, SSLEngine, etc.

Parameters:
ThreadAttachment - the attachment.

reset

public void reset()


Copyright © 2012 Oracle Corporation. All Rights Reserved.