java.util.concurrent.ExecutorService implementation.
| Modifier and Type | Class and Description |
|---|---|
| public abstract class |
| Modifier and Type | Field and Description |
|---|---|
| protected final ThreadPoolConfig | |
| public static final int | |
| public static final int | |
| public static final int | |
| public static final int | |
| protected final DelayedExecutor. | |
| private static final Logger | |
| protected final DefaultMonitoringConfig | monitoringConfig
ThreadPool probes |
| private static final Long | |
| protected static final Runnable | |
| protected volatile boolean | |
| protected final Object | |
| private static final DelayedExecutor. | |
| protected final long | |
| protected final Map |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| protected void | afterExecute(final AbstractThreadPool.
the worker,Worker, running the the thread tthe runnable that has completed. r, final Throwable the exception that caused termination, or null if execution completed normally. t)Method invoked upon completion of execution of the given Runnable. |
| public boolean | awaitTermination(final long timeout, final TimeUnit unit)
Implements java. Blocks until all tasks have completed execution after a shutdown request, or the timeout occurs, or the current thread is interrupted, whichever happens first. |
| protected void | beforeExecute(final AbstractThreadPool.
the worker,Worker, running the the thread tthe thread that will run task r. t, final Runnable the task that will be executed. r)Method invoked prior to executing the given Runnable in the given thread. |
| pack-priv Object | |
| protected static void | |
| public ThreadPoolConfig | getConfig()
Implements org. Returns: the thread pool configuration |
| protected final ThreadFactory | |
| public DefaultMonitoringConfig | getMonitoringConfig()
Implements org. Return the object associated |
| public Queue | |
| public int | |
| public final int | getSize()
Implements org. Returns: the number of allocated threads in the thread pool |
| public boolean | isShutdown()
Implements org. Returns |
| public boolean | isTerminated()
Implements java. Returns |
| protected void | onMaxNumberOfThreadsReached()
Method is called by AbstractThreadPool, when maximum number of worker threads is reached and task will need to wait in task queue, until one of the threads will be able to process it. |
| protected void | onTaskCancelled(Runnable task)
Method is called by a thread pool each time a dequeued task has been canceled instead of being processed. |
| protected void | onTaskCompletedEvent(Runnable
the unit of work that has completed processing task)
This method will be invoked when a the specified |
| protected void | onTaskDequeued(Runnable task)
Method is called by a thread pool each time a task has been dequeued from a task queue. |
| protected void | onTaskQueued(Runnable task)
Method is called by a thread pool each time new task has been queued to a task queue. |
| protected void | onTaskQueueOverflow()
Method is called by a thread pool, when new task could not be added to a task queue, because task queue is full. |
| protected void | onWorkerExit(AbstractThreadPool.
Method is called by |
| protected void | onWorkerStarted(final AbstractThreadPool.
Method is called by |
| protected void | |
| public void | shutdown()
Implements java. Initiates an orderly shutdown in which previously submitted tasks are executed, but no new tasks will be accepted. |
| public List | shutdownNow()
Implements java. Attempts to stop all actively executing tasks, halts the processing of waiting tasks, and returns a list of the tasks that were awaiting execution. |
| protected void | |
| public String | |
| public void | uncaughtException(Thread thread, Throwable throwable)
Implements java. Method invoked when the given thread terminates due to the given uncaught exception. |
| protected void |
| config | back to summary |
|---|---|
| protected final ThreadPoolConfig config | |
| DEFAULT_IDLE_THREAD_KEEPALIVE_TIMEOUT | back to summary |
|---|---|
| public static final int DEFAULT_IDLE_THREAD_KEEPALIVE_TIMEOUT | |
| DEFAULT_MAX_TASKS_QUEUED | back to summary |
|---|---|
| public static final int DEFAULT_MAX_TASKS_QUEUED | |
| DEFAULT_MAX_THREAD_COUNT | back to summary |
|---|---|
| public static final int DEFAULT_MAX_THREAD_COUNT | |
| DEFAULT_MIN_THREAD_COUNT | back to summary |
|---|---|
| public static final int DEFAULT_MIN_THREAD_COUNT | |
| delayedQueue | back to summary |
|---|---|
| protected final DelayedExecutor. | |
| logger | back to summary |
|---|---|
| private static final Logger logger | |
| monitoringConfig | back to summary |
|---|---|
| protected final DefaultMonitoringConfig<ThreadPoolProbe> monitoringConfig ThreadPool probes | |
| NEVER_TIMEOUT | back to summary |
|---|---|
| private static final Long NEVER_TIMEOUT | |
| poison | back to summary |
|---|---|
| protected static final Runnable poison | |
| running | back to summary |
|---|---|
| protected volatile boolean running | |
| stateLock | back to summary |
|---|---|
| protected final Object stateLock | |
| transactionResolver | back to summary |
|---|---|
| private static final DelayedExecutor. | |
| transactionTimeoutMillis | back to summary |
|---|---|
| protected final long transactionTimeoutMillis | |
| workers | back to summary |
|---|---|
| protected final Map<AbstractThreadPool. | |
| AbstractThreadPool | back to summary |
|---|---|
| public AbstractThreadPool(ThreadPoolConfig config) | |
| afterExecute | back to summary |
|---|---|
| protected void afterExecute(final AbstractThreadPool. Method invoked upon completion of execution of the given Runnable. This method is invoked by the thread that executed the task. If non-null, the Throwable is the uncaught RuntimeException or Error that caused execution to terminate abruptly. Note When actions are enclosed in tasks (such as This implementation does nothing, but may be customized in subclasses. Note To properly nest multiple overridings, subclasses should generally invoke super.afterExecute at the beginning of this method.
| |
| awaitTermination | back to summary |
|---|---|
| public boolean awaitTermination(final long timeout, final TimeUnit unit) throws InterruptedException Implements java. Doc from java. Blocks until all tasks have completed execution after a shutdown request, or the timeout occurs, or the current thread is interrupted, whichever happens first.
| |
| beforeExecute | back to summary |
|---|---|
| protected void beforeExecute(final AbstractThreadPool. 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.
| |
| createJmxManagementObject | back to summary |
|---|---|
| pack-priv Object createJmxManagementObject() | |
| drain | back to summary |
|---|---|
| protected static void drain(Queue<Runnable> from, Collection<Runnable> to) | |
| getConfig | back to summary |
|---|---|
| public ThreadPoolConfig getConfig() Implements org.
| |
| getDefaultThreadFactory | back to summary |
|---|---|
| protected final ThreadFactory getDefaultThreadFactory() | |
| getMonitoringConfig | back to summary |
|---|---|
| public DefaultMonitoringConfig Implements org. Doc from org. Return the object associated
| |
| getQueue | back to summary |
|---|---|
| public Queue | |
| getQueueSize | back to summary |
|---|---|
| public int getQueueSize() Implements org.
| |
| getSize | back to summary |
|---|---|
| public final int getSize() Implements org.
| |
| isShutdown | back to summary |
|---|---|
| public boolean isShutdown() Implements org. Doc from java. Returns
| |
| isTerminated | back to summary |
|---|---|
| public boolean isTerminated() Implements java. Doc from java. Returns
| |
| onMaxNumberOfThreadsReached | back to summary |
|---|---|
| protected void onMaxNumberOfThreadsReached() Method is called by AbstractThreadPool, when maximum number of worker threads is reached and task will need to wait in task queue, until one of the threads will be able to process it. | |
| onTaskCancelled | back to summary |
|---|---|
| protected void onTaskCancelled(Runnable task) Method is called by a thread pool each time a dequeued task has been canceled instead of being processed. | |
| onTaskCompletedEvent | back to summary |
|---|---|
| protected void onTaskCompletedEvent(Runnable task)
This method will be invoked when a the specified
| |
| onTaskDequeued | back to summary |
|---|---|
| protected void onTaskDequeued(Runnable task) Method is called by a thread pool each time a task has been dequeued from a task queue. | |
| onTaskQueued | back to summary |
|---|---|
| protected void onTaskQueued(Runnable task) Method is called by a thread pool each time new task has been queued to a task queue. | |
| onTaskQueueOverflow | back to summary |
|---|---|
| protected void onTaskQueueOverflow() Method is called by a thread pool, when new task could not be added to a task queue, because task queue is full.
throws | |
| onWorkerExit | back to summary |
|---|---|
| protected void onWorkerExit(AbstractThreadPool. Method is called by | |
| onWorkerStarted | back to summary |
|---|---|
| protected void onWorkerStarted(final AbstractThreadPool. Method is called by | |
| poisonAll | back to summary |
|---|---|
| protected void poisonAll() | |
| shutdown | back to summary |
|---|---|
| public void shutdown() Implements java. Doc from java. Initiates an orderly shutdown in which previously submitted tasks are executed, but no new tasks will be accepted. Invocation has no additional effect if already shut down. This method does not wait for previously submitted tasks to
complete execution. Use
| |
| shutdownNow | back to summary |
|---|---|
| public List Implements java. Doc from java. Attempts to stop all actively executing tasks, halts the processing of waiting tasks, and returns a list of the tasks that were awaiting execution. This method does not wait for actively executing tasks to
terminate. Use There are no guarantees beyond best-effort attempts to stop
processing actively executing tasks. For example, typical
implementations will cancel via
| |
| startWorker | back to summary |
|---|---|
| protected void startWorker(final AbstractThreadPool. must hold statelock while calling this method. | |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object.
Satisfying this method's contract implies a non-
| |
| uncaughtException | back to summary |
|---|---|
| public void uncaughtException(Thread thread, Throwable throwable) Implements java. Doc from java. Method invoked when the given thread terminates due to the given uncaught exception. Any exception thrown by this method will be ignored by the Java Virtual Machine.
| |
| validateNewPoolSize | back to summary |
|---|---|
| protected void validateNewPoolSize(int corePoolsize, int maxPoolSize) | |
| Modifier and Type | Field and Description |
|---|---|
| protected Thread | |
| protected volatile long |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| protected void | |
| protected abstract Runnable | |
| public void |
| t | back to summary |
|---|---|
| protected Thread t | |
| transactionExpirationTime | back to summary |
|---|---|
| protected volatile long transactionExpirationTime | |
| Worker | back to summary |
|---|---|
| public Worker() | |
| doWork | back to summary |
|---|---|
| protected void doWork() | |
| getTask | back to summary |
|---|---|
| protected abstract Runnable getTask() throws InterruptedException | |
| run | back to summary |
|---|---|
| public void run() Implements java. Doc from java. Runs this operation.
| |