org.glassfish.grizzly.threadpool
Class SyncThreadPool
java.lang.Object
java.util.concurrent.AbstractExecutorService
org.glassfish.grizzly.threadpool.AbstractThreadPool
org.glassfish.grizzly.threadpool.SyncThreadPool
- All Implemented Interfaces:
- java.lang.Thread.UncaughtExceptionHandler, java.util.concurrent.Executor, java.util.concurrent.ExecutorService, JmxMonitoringAware<ThreadPoolProbe>, MonitoringAware<ThreadPoolProbe>
public class SyncThreadPool
- extends AbstractThreadPool
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
| 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, stateLockCondition, transactionTimeoutMillis, workers |
| Methods inherited from class org.glassfish.grizzly.threadpool.AbstractThreadPool |
afterExecute, awaitTermination, beforeExecute, drain, getConfig, getDefaultThreadFactory, getMonitoringConfig, getQueue, isShutdown, isTerminated, nextThreadId, onMaxNumberOfThreadsReached, 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 |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
maxQueuedTasks
protected volatile int maxQueuedTasks
SyncThreadPool
public SyncThreadPool(ThreadPoolConfig config)
start
public void start()
stop
public void stop()
getCurrentPoolSize
public int getCurrentPoolSize()
getActiveThreadsCount
public int getActiveThreadsCount()
execute
public void execute(java.lang.Runnable task)
startWorker
protected void startWorker(AbstractThreadPool.Worker worker)
- Description copied from class:
AbstractThreadPool
- must hold statelock while calling this method.
- Overrides:
startWorker in class AbstractThreadPool
onWorkerExit
protected void onWorkerExit(AbstractThreadPool.Worker worker)
- Description copied from class:
AbstractThreadPool
- Method is called by
AbstractThreadPool.Worker, when it's completing
AbstractThreadPool.Worker.run() method execution, which in most cases means,
that ThreadPool's thread will be released. This method is called from
AbstractThreadPool.Worker's thread.
- Overrides:
onWorkerExit in class AbstractThreadPool
poisonAll
protected void poisonAll()
- Overrides:
poisonAll in class AbstractThreadPool
toString
public java.lang.String toString()
- Overrides:
toString in class AbstractThreadPool
Copyright © 2012 Oracle Corporation. All Rights Reserved.