Top Description Fields Constructors Methods
org.glassfish.grizzly.threadpool

public Class DefaultWorkerThread

extends Thread
implements WorkerThread
Class Inheritance
All Implemented Interfaces
org.glassfish.grizzly.threadpool.WorkerThread, org.glassfish.grizzly.attributes.AttributeStorage, java.lang.Runnable
Imports
java.util.concurrent.TimeUnit, org.glassfish.grizzly.ThreadCache, .ThreadCache.ObjectCache, org.glassfish.grizzly.attributes.AttributeBuilder, .AttributeHolder, org.glassfish.grizzly.memory.ThreadLocalPool

Default Grizzly worker thread implementation
Author
Alexey Stashok

Field Summary

Modifier and TypeField and Description
private final AttributeHolder
private final ThreadLocalPool<E>
private final ThreadCache.ObjectCache
private long
Inherited from java.lang.Thread:
MAX_PRIORITYMIN_PRIORITYNORM_PRIORITY

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
public AttributeHolder
public final <E> E

Returns:

cached object.
getFromCache
(final ThreadCache.CachedTypeIndex<E>
the cached object type index.
index
)

Get the cached object with the given type index from cache.

public ThreadLocalPool<E>
public Thread
public long
public final <E> boolean
putToCache(final ThreadCache.CachedTypeIndex<E> index, final E o)

public void
public final <E> E

Returns:

cached object.
takeFromCache
(final ThreadCache.CachedTypeIndex<E>
the cached object type index.
index
)

Take the cached object with the given type index from cache.

Inherited from java.lang.Thread:
activeCountcheckAccessclonecurrentThreaddumpStackenumerategetAllStackTracesgetContextClassLoadergetDefaultUncaughtExceptionHandlergetIdgetNamegetPrioritygetStackTracegetStategetThreadGroupgetUncaughtExceptionHandlerholdsLockinterruptinterruptedisAliveisDaemonisInterruptedisVirtualjoinjoinjoinjoinofPlatformofVirtualonSpinWaitrunsetContextClassLoadersetDaemonsetDefaultUncaughtExceptionHandlersetNamesetPrioritysetUncaughtExceptionHandlersleepsleepsleepstartstartVirtualThreadthreadIdtoStringyield

Field Detail

attributesback to summary
private final AttributeHolder attributes
memoryPoolback to summary
private final ThreadLocalPool<E> memoryPool
objectCacheback to summary
private final ThreadCache.ObjectCache objectCache
transactionTimeoutMillisback to summary
private long transactionTimeoutMillis

Constructor Detail

DefaultWorkerThreadback to summary
public DefaultWorkerThread(AttributeBuilder attrBuilder, String name, ThreadLocalPool<E> pool, Runnable runTask)

Method Detail

destroyback to summary
public void destroy()
getAttributesback to summary
public AttributeHolder getAttributes()

Implements org.glassfish.grizzly.attributes.AttributeStorage.getAttributes.

Doc from org.glassfish.grizzly.attributes.AttributeStorage.getAttributes.

Get associated AttributeHolder. Implementation may return null if AttributeHolder wasn't initialized yet.

Annotations
@Override
getFromCacheback to summary
public final <E> E getFromCache(final ThreadCache.CachedTypeIndex<E> index)

Get the cached object with the given type index from cache. Unlike takeFromCache(org.glassfish.grizzly.ThreadCache.CachedTypeIndex), the object won't be removed from cache.

Parameters
index:ThreadCache.CachedTypeIndex<E>

the cached object type index.

Returns:E

cached object.

getMemoryPoolback to summary
public ThreadLocalPool<E> getMemoryPool()
getThreadback to summary
public Thread getThread()

Implements org.glassfish.grizzly.threadpool.WorkerThread.getThread.

Annotations
@Override
getTransactionTimeoutback to summary
public long getTransactionTimeout(TimeUnit timeunit)

Implements org.glassfish.grizzly.threadpool.WorkerThread.getTransactionTimeout.

Annotations
@Override
putToCacheback to summary
public final <E> boolean putToCache(final ThreadCache.CachedTypeIndex<E> index, final E o)
setTransactionTimeoutback to summary
public void setTransactionTimeout(long timeout, TimeUnit timeunit)

Implements org.glassfish.grizzly.threadpool.WorkerThread.setTransactionTimeout.

Annotations
@Override
takeFromCacheback to summary
public final <E> E takeFromCache(final ThreadCache.CachedTypeIndex<E> index)

Take the cached object with the given type index from cache. Unlike getFromCache(org.glassfish.grizzly.ThreadCache.CachedTypeIndex), the object will be removed from cache.

Parameters
index:ThreadCache.CachedTypeIndex<E>

the cached object type index.

Returns:E

cached object.