com.sun.grizzly.threadpool
Class DefaultWorkerThread

java.lang.Object
  extended by java.lang.Thread
      extended by com.sun.grizzly.threadpool.DefaultWorkerThread
All Implemented Interfaces:
AttributeStorage, WorkerThread, Runnable

public class DefaultWorkerThread
extends Thread
implements WorkerThread

Default Grizzly worker thread implementation

Author:
Alexey Stashok

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
 
Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Fields inherited from interface com.sun.grizzly.threadpool.WorkerThread
UNLIMITED_TRANSACTION_TIMEOUT
 
Constructor Summary
DefaultWorkerThread(AttributeBuilder attrBuilder, String name, Runnable runTask)
           
 
Method Summary
protected  AttributeHolder createAttributeHolder()
           
 DefaultMemoryManager.BufferInfo getAssociatedBuffer()
           
 AttributeHolder getAttributes()
          Get associated AttributeHolder.
 Context getCachedContext()
           
 Thread getThread()
           
 long getTransactionStartedTime(TimeUnit timeunit)
           
 long getTransactionTimeout(TimeUnit timeunit)
           
 AttributeHolder obtainAttributes()
          Get associated AttributeHolder.
protected  void onAfterRun()
           
protected  void onBeforeRun()
           
 void setAssociatedBuffer(DefaultMemoryManager.BufferInfo associatedBuffer)
           
 void setCachedContext(Context cachedContext)
           
 void setTransactionTimeout(long timeout, TimeUnit timeunit)
           
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, 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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.sun.grizzly.threadpool.WorkerThread
destroy, getName, start, stop
 
Methods inherited from interface java.lang.Runnable
run
 

Constructor Detail

DefaultWorkerThread

public DefaultWorkerThread(AttributeBuilder attrBuilder,
                           String name,
                           Runnable runTask)
Method Detail

getThread

public Thread getThread()
Specified by:
getThread in interface WorkerThread

getAttributes

public AttributeHolder getAttributes()
Description copied from interface: AttributeStorage
Get associated AttributeHolder. Implementation may return null if AttributeHolder wasn't initialized yet.

Specified by:
getAttributes in interface AttributeStorage
Specified by:
getAttributes in interface WorkerThread
Returns:
associated AttributeHolder. Implementation may return null if AttributeHolder wasn't initialized yet.

obtainAttributes

public AttributeHolder obtainAttributes()
Description copied from interface: AttributeStorage
Get associated AttributeHolder. Unlike AttributeStorage.getAttributes() - method never returns null.

Specified by:
obtainAttributes in interface AttributeStorage
Specified by:
obtainAttributes in interface WorkerThread
Returns:
associated AttributeHolder. Unlike AttributeStorage.getAttributes() - method never returns null.

getAssociatedBuffer

public DefaultMemoryManager.BufferInfo getAssociatedBuffer()

setAssociatedBuffer

public void setAssociatedBuffer(DefaultMemoryManager.BufferInfo associatedBuffer)

getCachedContext

public Context getCachedContext()

setCachedContext

public void setCachedContext(Context cachedContext)

getTransactionTimeout

public long getTransactionTimeout(TimeUnit timeunit)
Specified by:
getTransactionTimeout in interface WorkerThread

setTransactionTimeout

public void setTransactionTimeout(long timeout,
                                  TimeUnit timeunit)
Specified by:
setTransactionTimeout in interface WorkerThread

getTransactionStartedTime

public long getTransactionStartedTime(TimeUnit timeunit)

onBeforeRun

protected void onBeforeRun()

onAfterRun

protected void onAfterRun()

createAttributeHolder

protected AttributeHolder createAttributeHolder()


Copyright © 2009 SUN Microsystems. All Rights Reserved.