Package org.glassfish.grizzly.threadpool
Class DefaultWorkerThread
java.lang.Object
java.lang.Thread
org.glassfish.grizzly.threadpool.DefaultWorkerThread
- All Implemented Interfaces:
Runnable
,AttributeStorage
,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 org.glassfish.grizzly.threadpool.WorkerThread
UNLIMITED_TRANSACTION_TIMEOUT
-
Constructor Summary
ConstructorDescriptionDefaultWorkerThread
(AttributeBuilder attrBuilder, String name, ThreadLocalPool pool, Runnable runTask) -
Method Summary
Modifier and TypeMethodDescriptionvoid
destroy()
Get associatedAttributeHolder
.final <E> E
getFromCache
(ThreadCache.CachedTypeIndex<E> index) Get the cached object with the given type index from cache.long
getTransactionTimeout
(TimeUnit timeunit) final <E> boolean
putToCache
(ThreadCache.CachedTypeIndex<E> index, E o) void
setTransactionTimeout
(long timeout, TimeUnit timeunit) final <E> E
takeFromCache
(ThreadCache.CachedTypeIndex<E> index) Take the cached object with the given type index from cache.Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, run, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, toString, yield
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.glassfish.grizzly.threadpool.WorkerThread
getName, start, stop
-
Constructor Details
-
DefaultWorkerThread
public DefaultWorkerThread(AttributeBuilder attrBuilder, String name, ThreadLocalPool pool, Runnable runTask)
-
-
Method Details
-
getThread
- Specified by:
getThread
in interfaceWorkerThread
-
getAttributes
Description copied from interface:AttributeStorage
Get associatedAttributeHolder
. Implementation may return null ifAttributeHolder
wasn't initialized yet.- Specified by:
getAttributes
in interfaceAttributeStorage
- Returns:
- associated
AttributeHolder
. Implementation may return null ifAttributeHolder
wasn't initialized yet.
-
getMemoryPool
-
getFromCache
Get the cached object with the given type index from cache. UnliketakeFromCache(org.glassfish.grizzly.ThreadCache.CachedTypeIndex)
, the object won't be removed from cache.- Type Parameters:
E
-- Parameters:
index
- the cached object type index.- Returns:
- cached object.
-
takeFromCache
Take the cached object with the given type index from cache. UnlikegetFromCache(org.glassfish.grizzly.ThreadCache.CachedTypeIndex)
, the object will be removed from cache.- Type Parameters:
E
-- Parameters:
index
- the cached object type index.- Returns:
- cached object.
-
putToCache
-
getTransactionTimeout
- Specified by:
getTransactionTimeout
in interfaceWorkerThread
-
setTransactionTimeout
- Specified by:
setTransactionTimeout
in interfaceWorkerThread
-
destroy
public void destroy()
-