java.lang.Object
java.util.concurrent.AbstractExecutorService
org.glassfish.grizzly.threadpool.AbstractThreadPool
org.glassfish.grizzly.threadpool.SyncThreadPool
- All Implemented Interfaces:
Thread.UncaughtExceptionHandler
,Executor
,ExecutorService
,MonitoringAware<ThreadPoolProbe>
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 Class Summary
Nested classes/interfaces inherited from class org.glassfish.grizzly.threadpool.AbstractThreadPool
AbstractThreadPool.Worker
-
Field Summary
Fields inherited from class org.glassfish.grizzly.threadpool.AbstractThreadPool
config, DEFAULT_IDLE_THREAD_KEEPALIVE_TIMEOUT, DEFAULT_MAX_TASKS_QUEUED, DEFAULT_MAX_THREAD_COUNT, DEFAULT_MIN_THREAD_COUNT, delayedQueue, monitoringConfig, poison, running, stateLock, transactionTimeoutMillis, workers
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
protected void
Method is called byAbstractThreadPool.Worker
, when it's completingAbstractThreadPool.Worker.run()
method execution, which in most cases means, that ThreadPool's thread will be released.protected void
protected void
startWorker
(AbstractThreadPool.Worker worker) must hold statelock while calling this method.toString()
Methods inherited from class org.glassfish.grizzly.threadpool.AbstractThreadPool
afterExecute, awaitTermination, beforeExecute, drain, getConfig, getDefaultThreadFactory, getMonitoringConfig, getQueue, getSize, isShutdown, isTerminated, onMaxNumberOfThreadsReached, onTaskCancelled, onTaskCompletedEvent, onTaskDequeued, onTaskQueued, onTaskQueueOverflow, onWorkerStarted, shutdown, shutdownNow, uncaughtException, validateNewPoolSize
Methods inherited from class java.util.concurrent.AbstractExecutorService
invokeAll, invokeAll, invokeAny, invokeAny, newTaskFor, newTaskFor, submit, submit, submit
-
Field Details
-
maxQueuedTasks
protected int maxQueuedTasks
-
-
Constructor Details
-
SyncThreadPool
-
-
Method Details
-
execute
-
startWorker
Description copied from class:AbstractThreadPool
must hold statelock while calling this method.- Overrides:
startWorker
in classAbstractThreadPool
-
onWorkerExit
Description copied from class:AbstractThreadPool
Method is called byAbstractThreadPool.Worker
, when it's completingAbstractThreadPool.Worker.run()
method execution, which in most cases means, that ThreadPool's thread will be released. This method is called fromAbstractThreadPool.Worker
's thread.- Overrides:
onWorkerExit
in classAbstractThreadPool
-
poisonAll
protected void poisonAll()- Overrides:
poisonAll
in classAbstractThreadPool
-
toString
- Overrides:
toString
in classAbstractThreadPool
-