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 sychronized 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, transactionTimeoutMillis, workers |
| Methods inherited from class org.glassfish.grizzly.threadpool.AbstractThreadPool |
afterExecute, beforeExecute, drain, getConfig, getDefaultThreadFactory, getMonitoringConfig, getQueue, isShutdown, nextThreadId, onMaxNumberOfThreadsReached, onTaskCompletedEvent, onTaskDequeued, onTaskQueued, onTaskQueueOverflow, 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
onWorkerStarted
protected void onWorkerStarted(AbstractThreadPool.Worker worker)
- Description copied from class:
AbstractThreadPool
- Method is called by
AbstractThreadPool.Worker, when it's starting
AbstractThreadPool.Worker.run() method execution, which means, that ThreadPool's
thread is getting active and ready to process tasks.
This method is called from AbstractThreadPool.Worker's thread.
- Overrides:
onWorkerStarted 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
isTerminated
public boolean isTerminated()
-
poisonAll
protected void poisonAll()
- Overrides:
poisonAll in class AbstractThreadPool
awaitTermination
public boolean awaitTermination(long timeout,
java.util.concurrent.TimeUnit unit)
throws java.lang.InterruptedException
-
- Throws:
java.lang.InterruptedException
toString
public java.lang.String toString()
- Overrides:
toString in class AbstractThreadPool
Copyright © 2011 Oracle Corpration. All Rights Reserved.