|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.lang.Thread
com.sun.grizzly.util.WorkerThread
com.sun.grizzly.util.WorkerThreadImpl
public class WorkerThreadImpl
Simple worker thread used for processing HTTP requests. All threads are
synchronized using a ExecutorService
object
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.lang.Thread |
---|
Thread.State, Thread.UncaughtExceptionHandler |
Field Summary | |
---|---|
static int |
DEFAULT_BYTE_BUFFER_SIZE
|
static ByteBufferFactory.ByteBufferType |
DEFAULT_BYTEBUFFER_TYPE
|
protected ThreadAttachment |
threadAttachment
The state/attributes on this WorkerThread. |
Fields inherited from class com.sun.grizzly.util.WorkerThread |
---|
byteBuffer, inputBB, outputBB, sslEngine |
Fields inherited from class java.lang.Thread |
---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
---|---|
WorkerThreadImpl(ExecutorService threadPool,
String name)
Create a Thread that will synchronizes/block on ExecutorService instance. |
|
WorkerThreadImpl(ExecutorService threadPool,
String name,
int initialByteBufferSize)
Create a Thread that will synchronizes/block on ExecutorService instance. |
|
WorkerThreadImpl(ExecutorService threadPool,
String name,
Runnable runnable,
int initialByteBufferSize)
Create a Thread that will synchronizes/block on ExecutorService instance. |
|
WorkerThreadImpl(Runnable runnable)
|
|
WorkerThreadImpl(String name,
Runnable runnable)
|
|
WorkerThreadImpl(ThreadGroup threadGroup,
Runnable runnable)
Create a Thread that will synchronizes/block on ExecutorService instance. |
|
WorkerThreadImpl(ThreadGroup threadGroup,
Runnable runnable,
int initialByteBufferSize)
Create a Thread that will synchronizes/block on ExecutorService instance. |
Method Summary | |
---|---|
void |
attach(ThreadAttachment threadAttachment)
Attach the ThreadAttachment to this instance. |
protected void |
createByteBuffer(boolean force)
Allocate a ByteBuffer if the current instance is null; |
ThreadAttachment |
detach()
Detach the current set of attributes (state) associated with this instance. |
ThreadAttachment |
getAttachment()
Get the current set of attributes (state) associated with this instance. |
ByteBufferFactory.ByteBufferType |
getByteBufferType()
The ByteBufferType used to create the ByteBuffer
associated with this object. |
Object |
getContext()
|
int |
getInitialByteBufferSize()
|
PendingIOhandler |
getPendingIOhandler()
Used by selectionkey attachments to enqueue io events that will be executed in selectorhandler.postselect by worker threads instead of the selector thread. |
protected void |
processTask(Callable t)
Processes the given task. |
void |
reset()
|
void |
setByteBufferType(ByteBufferFactory.ByteBufferType byteBufferType)
Set the ByteBufferType to use when creating the
ByteBuffer associated with this object. |
void |
setContext(Object context)
|
void |
setInitialByteBufferSize(int initialByteBufferSize)
|
void |
setPendingIOhandler(PendingIOhandler pendingIOhandler)
Used by selectionkey attachments to enqueue io events that will be executed in selectorhandler.postselect by worker threads instead of the selector thread. |
ThreadAttachment |
updateAttachment(int mode)
Updates Thread associated attachment according to the passed mode. |
Methods inherited from class com.sun.grizzly.util.WorkerThread |
---|
getByteBuffer, getInputBB, getOutputBB, getSSLEngine, setByteBuffer, setInputBB, setOutputBB, setSSLEngine |
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 |
---|
public static final int DEFAULT_BYTE_BUFFER_SIZE
public static final ByteBufferFactory.ByteBufferType DEFAULT_BYTEBUFFER_TYPE
protected ThreadAttachment threadAttachment
Constructor Detail |
---|
public WorkerThreadImpl(ThreadGroup threadGroup, Runnable runnable)
ExecutorService
instance.
threadGroup
- ThreadGroup
runnable
- Runnable
public WorkerThreadImpl(Runnable runnable)
public WorkerThreadImpl(String name, Runnable runnable)
public WorkerThreadImpl(ThreadGroup threadGroup, Runnable runnable, int initialByteBufferSize)
ExecutorService
instance.
threadGroup
- ThreadGroup
runnable
- Runnable
initialByteBufferSize
- initial ByteBuffer
sizepublic WorkerThreadImpl(ExecutorService threadPool, String name)
ExecutorService
instance.
threadPool
- ExecutorService
name
- String
public WorkerThreadImpl(ExecutorService threadPool, String name, int initialByteBufferSize)
ExecutorService
instance.
threadPool
- ExecutorService
name
- String
initialByteBufferSize
- initial ByteBuffer
sizepublic WorkerThreadImpl(ExecutorService threadPool, String name, Runnable runnable, int initialByteBufferSize)
ExecutorService
instance.
threadPool
- ExecutorService
name
- String
initialByteBufferSize
- initial ByteBuffer
sizeMethod Detail |
---|
protected void createByteBuffer(boolean force)
ByteBuffer
if the current instance is null;
public ThreadAttachment updateAttachment(int mode)
WorkerThread
updateAttachment
in class WorkerThread
public ThreadAttachment getAttachment()
WorkerThread
getAttachment
in class WorkerThread
public ThreadAttachment detach()
WorkerThread
detach
in class WorkerThread
public void attach(ThreadAttachment threadAttachment)
WorkerThread
attach
in class WorkerThread
public ByteBufferFactory.ByteBufferType getByteBufferType()
ByteBufferType
used to create the ByteBuffer
associated with this object.
ByteBufferType
used to create the ByteBuffer
associated with this object.public void setByteBufferType(ByteBufferFactory.ByteBufferType byteBufferType)
ByteBufferType
to use when creating the
ByteBuffer
associated with this object.
byteBufferType
- The ByteBuffer type.public int getInitialByteBufferSize()
public void setInitialByteBufferSize(int initialByteBufferSize)
protected void processTask(Callable t) throws Exception
t
- the task to process
Exception
public PendingIOhandler getPendingIOhandler()
public void setPendingIOhandler(PendingIOhandler pendingIOhandler)
public Object getContext()
public void setContext(Object context)
public void reset()
reset
in class WorkerThread
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |