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

public Class SyncThreadPool

extends AbstractThreadPool
Class Inheritance
Imports
java.util.LinkedList, .Queue, java.util.concurrent.ExecutorService, .RejectedExecutionException, .TimeUnit

ExecutorService implementation, which function the similar way as former Grizzly 1.x Pipeline based thread pools. The SyncThreadPool is synchronized similar way as Grizzly 1.x Pipeline, which makes thread pool more accurate when deciding to create or not additional worker threads.
Author
Alexey Stashok

Nested and Inner Type Summary

Modifier and TypeClass and Description
protected class

Field Summary

Modifier and TypeField and Description
private int
private int
protected int
private final Queue<Runnable>
Inherited from org.glassfish.grizzly.threadpool.AbstractThreadPool:
configDEFAULT_IDLE_THREAD_KEEPALIVE_TIMEOUTDEFAULT_MAX_TASKS_QUEUEDDEFAULT_MAX_THREAD_COUNTDEFAULT_MIN_THREAD_COUNTdelayedQueuemonitoringConfigpoisonrunningstateLocktransactionTimeoutMillisworkers

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
execute(Runnable task)

Implements java.util.concurrent.Executor.execute.

Executes the given command at some time in the future.

protected void
onWorkerExit(AbstractThreadPool.Worker worker)

Overrides org.glassfish.grizzly.threadpool.AbstractThreadPool.onWorkerExit.

Method is called by Worker, when it's completing Worker#run() method execution, which in most cases means, that ThreadPool's thread will be released.

protected void
protected void
startWorker(AbstractThreadPool.Worker worker)

Overrides org.glassfish.grizzly.threadpool.AbstractThreadPool.startWorker.

must hold statelock while calling this method.

public String
toString()

Overrides org.glassfish.grizzly.threadpool.AbstractThreadPool.toString.

Returns a string representation of the object.

Inherited from org.glassfish.grizzly.threadpool.AbstractThreadPool:
afterExecuteawaitTerminationbeforeExecutecreateJmxManagementObjectdraingetConfiggetDefaultThreadFactorygetMonitoringConfiggetQueuegetQueueSizegetSizeisShutdownisTerminatedonMaxNumberOfThreadsReachedonTaskCancelledonTaskCompletedEventonTaskDequeuedonTaskQueuedonTaskQueueOverflowonWorkerStartedshutdownshutdownNowuncaughtExceptionvalidateNewPoolSize

Field Detail

activeThreadsCountback to summary
private int activeThreadsCount
currentPoolSizeback to summary
private int currentPoolSize
maxQueuedTasksback to summary
protected int maxQueuedTasks
workQueueback to summary
private final Queue<Runnable> workQueue

Constructor Detail

SyncThreadPoolback to summary
public SyncThreadPool(ThreadPoolConfig config)

Method Detail

executeback to summary
public void execute(Runnable task)

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
onWorkerExitback to summary
protected void onWorkerExit(AbstractThreadPool.Worker worker)

Overrides org.glassfish.grizzly.threadpool.AbstractThreadPool.onWorkerExit.

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

Method is called by Worker, when it's completing Worker#run() method execution, which in most cases means, that ThreadPool's thread will be released. This method is called from Worker's thread.

Annotations
@Override
poisonAllback to summary
protected void poisonAll()

Overrides org.glassfish.grizzly.threadpool.AbstractThreadPool.poisonAll.

Annotations
@Override
startWorkerback to summary
protected void startWorker(AbstractThreadPool.Worker worker)

Overrides org.glassfish.grizzly.threadpool.AbstractThreadPool.startWorker.

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

must hold statelock while calling this method.

Annotations
@Override
toStringback to summary
public String toString()

Overrides org.glassfish.grizzly.threadpool.AbstractThreadPool.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Annotations
@Override
org.glassfish.grizzly.threadpool back to summary

protected Class SyncThreadPool.SyncThreadWorker

extends Worker
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final boolean
Inherited from org.glassfish.grizzly.threadpool.AbstractThreadPool.Worker:
ttransactionExpirationTime

Constructor Summary

AccessConstructor and Description
public
SyncThreadWorker(boolean core)

Method Summary

Modifier and TypeMethod and Description
protected Runnable
Inherited from org.glassfish.grizzly.threadpool.AbstractThreadPool.Worker:
doWorkrun

Field Detail

coreback to summary
private final boolean core

Constructor Detail

SyncThreadWorkerback to summary
public SyncThreadWorker(boolean core)

Method Detail

getTaskback to summary
protected Runnable getTask() throws InterruptedException

Implements abstract org.glassfish.grizzly.threadpool.AbstractThreadPool.Worker.getTask.

Annotations
@Override