public class TaskThreadPoolExecutor extends 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 RejectedExecutionExceptionThreadPoolExecutor.AbortPolicy, ThreadPoolExecutor.CallerRunsPolicy, ThreadPoolExecutor.DiscardOldestPolicy, ThreadPoolExecutor.DiscardPolicy| 构造器和说明 |
|---|
TaskThreadPoolExecutor(int corePoolSize,
int maximumPoolSize,
long keepAliveTime,
TimeUnit unit,
BlockingQueue<Runnable> workQueue) |
TaskThreadPoolExecutor(int corePoolSize,
int maximumPoolSize,
long keepAliveTime,
TimeUnit unit,
BlockingQueue<Runnable> workQueue,
RejectedExecutionHandler handler) |
TaskThreadPoolExecutor(int corePoolSize,
int maximumPoolSize,
long keepAliveTime,
TimeUnit unit,
BlockingQueue<Runnable> workQueue,
ThreadFactory threadFactory) |
TaskThreadPoolExecutor(int corePoolSize,
int maximumPoolSize,
long keepAliveTime,
TimeUnit unit,
BlockingQueue<Runnable> workQueue,
ThreadFactory threadFactory,
RejectedExecutionHandler handler) |
| 限定符和类型 | 方法和说明 |
|---|---|
protected void |
afterExecute(Runnable r,
Throwable t) |
void |
contextStopping() |
protected boolean |
currentThreadShouldBeStopped() |
void |
execute(Runnable command) |
void |
execute(Runnable command,
long timeout,
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, toStringinvokeAll, invokeAll, invokeAny, invokeAny, newTaskFor, newTaskFor, submit, submit, submitpublic TaskThreadPoolExecutor(int corePoolSize,
int maximumPoolSize,
long keepAliveTime,
TimeUnit unit,
BlockingQueue<Runnable> workQueue,
RejectedExecutionHandler handler)
public TaskThreadPoolExecutor(int corePoolSize,
int maximumPoolSize,
long keepAliveTime,
TimeUnit unit,
BlockingQueue<Runnable> workQueue,
ThreadFactory threadFactory,
RejectedExecutionHandler handler)
public TaskThreadPoolExecutor(int corePoolSize,
int maximumPoolSize,
long keepAliveTime,
TimeUnit unit,
BlockingQueue<Runnable> workQueue,
ThreadFactory threadFactory)
public TaskThreadPoolExecutor(int corePoolSize,
int maximumPoolSize,
long keepAliveTime,
TimeUnit unit,
BlockingQueue<Runnable> workQueue)
public long getThreadRenewalDelay()
public void setThreadRenewalDelay(long threadRenewalDelay)
protected void afterExecute(Runnable r, Throwable t)
afterExecute 在类中 ThreadPoolExecutorprotected void stopCurrentThreadIfNeeded()
protected boolean currentThreadShouldBeStopped()
public int getSubmittedCount()
public void execute(Runnable command)
execute 在接口中 Executorexecute 在类中 ThreadPoolExecutorpublic void execute(Runnable command, long timeout, TimeUnit unit)
command - the runnable taskRejectedExecutionException - if this task cannot be
accepted for execution - the queue is fullNullPointerException - if command or unit is nullpublic void contextStopping()
Copyright © 2020. All Rights Reserved.