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

pack-priv final Class QueueLimitedThreadPool

extends FixedThreadPool
Class Inheritance
Imports
java.util.concurrent.RejectedExecutionException, .Semaphore

Need to evaluate queue size limit perf implications on this fixedpool variant. The atomic counter can in theory approach synchronized (lack of) scalability in heavy load situations.
Authors
gustav trede, Tigran Mkrtchyan

Field Summary

Modifier and TypeField and Description
private final Semaphore
Inherited from org.glassfish.grizzly.threadpool.FixedThreadPool:
workQueue

Constructor Summary

AccessConstructor and Description
pack-priv
QueueLimitedThreadPool(ThreadPoolConfig
the ThreadPoolConfig to configure this pool.
config
)

Method Summary

Modifier and TypeMethod and Description
protected void
beforeExecute(final AbstractThreadPool.Worker worker, final Thread t, final Runnable r)

Overrides org.glassfish.grizzly.threadpool.AbstractThreadPool.beforeExecute.

Method invoked prior to executing the given Runnable in the given thread.

public void
execute(Runnable command)

Overrides org.glassfish.grizzly.threadpool.FixedThreadPool.execute.

Implements java.util.concurrent.Executor.execute.

Executes the given command at some time in the future.

Field Detail

queuePermitsback to summary
private final Semaphore queuePermits

Constructor Detail

QueueLimitedThreadPoolback to summary
pack-priv QueueLimitedThreadPool(ThreadPoolConfig config)
Parameters
config:ThreadPoolConfig

the ThreadPoolConfig to configure this pool.

Method Detail

beforeExecuteback to summary
protected void beforeExecute(final AbstractThreadPool.Worker worker, final Thread t, final Runnable r)

Overrides org.glassfish.grizzly.threadpool.AbstractThreadPool.beforeExecute.

Doc from org.glassfish.grizzly.threadpool.AbstractThreadPool.beforeExecute.

Method invoked prior to executing the given Runnable in the given thread. This method is invoked by thread t that will execute task r, and may be used to re-initialize ThreadLocals, or to perform logging.

This implementation does nothing, but may be customized in subclasses.

Note

To properly nest multiple overridings, subclasses should generally invoke super.beforeExecute at the end of this method.

Annotations
@Override
executeback to summary
public void execute(Runnable command)

Overrides org.glassfish.grizzly.threadpool.FixedThreadPool.execute.

Implements java.util.concurrent.Executor.execute.

Doc from java.util.concurrent.Executor.execute.

Executes the given command at some time in the future. The command may execute in a new thread, in a pooled thread, or in the calling thread, at the discretion of the Executor implementation.

Annotations
@Override