public class ThreadPoolExecutor
extends java.util.concurrent.ThreadPoolExecutor
getSubmittedCount()
method, to be used to properly handle the work queue.
If a RejectedExecutionHandler is not specified a default one will be configured
and that one will always throw a RejectedExecutionExceptionjava.util.concurrent.ThreadPoolExecutor.AbortPolicy, java.util.concurrent.ThreadPoolExecutor.CallerRunsPolicy, java.util.concurrent.ThreadPoolExecutor.DiscardOldestPolicy, java.util.concurrent.ThreadPoolExecutor.DiscardPolicy
Modifier and Type | Field and Description |
---|---|
protected static StringManager |
sm
The string manager for this package.
|
Constructor and Description |
---|
ThreadPoolExecutor(int corePoolSize,
int maximumPoolSize,
long keepAliveTime,
java.util.concurrent.TimeUnit unit,
java.util.concurrent.BlockingQueue<java.lang.Runnable> workQueue) |
ThreadPoolExecutor(int corePoolSize,
int maximumPoolSize,
long keepAliveTime,
java.util.concurrent.TimeUnit unit,
java.util.concurrent.BlockingQueue<java.lang.Runnable> workQueue,
java.util.concurrent.RejectedExecutionHandler handler) |
ThreadPoolExecutor(int corePoolSize,
int maximumPoolSize,
long keepAliveTime,
java.util.concurrent.TimeUnit unit,
java.util.concurrent.BlockingQueue<java.lang.Runnable> workQueue,
java.util.concurrent.ThreadFactory threadFactory) |
ThreadPoolExecutor(int corePoolSize,
int maximumPoolSize,
long keepAliveTime,
java.util.concurrent.TimeUnit unit,
java.util.concurrent.BlockingQueue<java.lang.Runnable> workQueue,
java.util.concurrent.ThreadFactory threadFactory,
java.util.concurrent.RejectedExecutionHandler handler) |
Modifier and Type | Method and Description |
---|---|
protected void |
afterExecute(java.lang.Runnable r,
java.lang.Throwable t) |
void |
contextStopping() |
protected boolean |
currentThreadShouldBeStopped() |
void |
execute(java.lang.Runnable command) |
void |
execute(java.lang.Runnable command,
long timeout,
java.util.concurrent.TimeUnit unit)
Executes the given command at some time in the future.
|
int |
getSubmittedCount() |
long |
getThreadRenewalDelay() |
void |
setThreadRenewalDelay(long threadRenewalDelay) |
protected void |
stopCurrentThreadIfNeeded()
If the current thread was started before the last time when a context was
stopped, an exception is thrown so that the current thread is stopped.
|
allowCoreThreadTimeOut, allowsCoreThreadTimeOut, awaitTermination, beforeExecute, finalize, getActiveCount, getCompletedTaskCount, getCorePoolSize, getKeepAliveTime, getLargestPoolSize, getMaximumPoolSize, getPoolSize, getQueue, getRejectedExecutionHandler, getTaskCount, getThreadFactory, isShutdown, isTerminated, isTerminating, prestartAllCoreThreads, prestartCoreThread, purge, remove, setCorePoolSize, setKeepAliveTime, setMaximumPoolSize, setRejectedExecutionHandler, setThreadFactory, shutdown, shutdownNow, terminated, toString
protected static final StringManager sm
public ThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, java.util.concurrent.TimeUnit unit, java.util.concurrent.BlockingQueue<java.lang.Runnable> workQueue, java.util.concurrent.RejectedExecutionHandler handler)
public ThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, java.util.concurrent.TimeUnit unit, java.util.concurrent.BlockingQueue<java.lang.Runnable> workQueue, java.util.concurrent.ThreadFactory threadFactory, java.util.concurrent.RejectedExecutionHandler handler)
public ThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, java.util.concurrent.TimeUnit unit, java.util.concurrent.BlockingQueue<java.lang.Runnable> workQueue, java.util.concurrent.ThreadFactory threadFactory)
public ThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, java.util.concurrent.TimeUnit unit, java.util.concurrent.BlockingQueue<java.lang.Runnable> workQueue)
public long getThreadRenewalDelay()
public void setThreadRenewalDelay(long threadRenewalDelay)
protected void afterExecute(java.lang.Runnable r, java.lang.Throwable t)
afterExecute
in class java.util.concurrent.ThreadPoolExecutor
protected void stopCurrentThreadIfNeeded()
protected boolean currentThreadShouldBeStopped()
public int getSubmittedCount()
public void execute(java.lang.Runnable command)
execute
in interface java.util.concurrent.Executor
execute
in class java.util.concurrent.ThreadPoolExecutor
public void execute(java.lang.Runnable command, long timeout, java.util.concurrent.TimeUnit unit)
command
- the runnable taskjava.util.concurrent.RejectedExecutionException
- if this task cannot be
accepted for execution - the queue is fulljava.lang.NullPointerException
- if command or unit is nullpublic void contextStopping()
Copyright © 2000-2018 Apache Software Foundation. All Rights Reserved.