public class OrderedDtpExecutor extends DtpExecutor
OrderedDtpExecutor can ensure that the delivered tasks are executed
according to the key and task submission order. It is applicable to scenarios
where the throughput is improved through parallel processing and the tasks
are run in a certain order.ThreadPoolExecutor.AbortPolicy, ThreadPoolExecutor.CallerRunsPolicy, ThreadPoolExecutor.DiscardOldestPolicy, ThreadPoolExecutor.DiscardPolicyExecutorAdapter.UnsupportedBlockingQueue| 限定符和类型 | 字段和说明 |
|---|---|
protected AtomicInteger |
count |
protected List<DtpExecutor> |
executors |
awaitTerminationSeconds, threadPoolName, waitForTasksToCompleteOnShutdown| 构造器和说明 |
|---|
OrderedDtpExecutor(int corePoolSize,
int maximumPoolSize,
long keepAliveTime,
TimeUnit unit,
BlockingQueue<Runnable> workQueue) |
OrderedDtpExecutor(int corePoolSize,
int maximumPoolSize,
long keepAliveTime,
TimeUnit unit,
BlockingQueue<Runnable> workQueue,
RejectedExecutionHandler handler) |
OrderedDtpExecutor(int corePoolSize,
int maximumPoolSize,
long keepAliveTime,
TimeUnit unit,
BlockingQueue<Runnable> workQueue,
ThreadFactory threadFactory) |
OrderedDtpExecutor(int corePoolSize,
int maximumPoolSize,
long keepAliveTime,
TimeUnit unit,
BlockingQueue<Runnable> workQueue,
ThreadFactory threadFactory,
RejectedExecutionHandler handler) |
| 限定符和类型 | 方法和说明 |
|---|---|
boolean |
awaitTermination(long timeout,
TimeUnit unit) |
protected DtpExecutor |
choose(Object arg) |
void |
execute(Object arg,
Runnable command) |
void |
execute(Runnable command)
Execute the task
|
int |
getCorePoolSize()
Get the core pool size
|
int |
getMaximumPoolSize()
Get the maximum pool size
|
int |
getPoolSize()
Get the pool size
|
boolean |
isShutdown() |
boolean |
isTerminated() |
void |
setCorePoolSize(int corePoolSize)
Set the core pool size
|
void |
shutdown() |
List<Runnable> |
shutdownNow() |
<T> Future<T> |
submit(Callable<T> task) |
<T> Future<T> |
submit(Object arg,
Callable<T> task) |
Future<?> |
submit(Object arg,
Runnable task) |
<T> Future<T> |
submit(Object arg,
Runnable task,
T result) |
Future<?> |
submit(Runnable task) |
<T> Future<T> |
submit(Runnable task,
T result) |
afterExecute, beforeExecute, execute, getNotifyItems, getOriginal, getPlatformIds, getQueueCapacity, getQueueName, getQueueTimeout, getQueueTimeoutCount, getRejectCount, getRejectHandlerName, getRunTimeout, getRunTimeoutCount, getThreadPoolAliasName, incRejectCount, initialize, isNotifyEnabled, setAllowCoreThreadTimeOut, setNotifyEnabled, setNotifyItems, setPlatformIds, setPreStartAllCoreThreads, setQueueTimeout, setRejectHandlerName, setRunTimeout, setTaskWrappers, setThreadPoolAliasName, wrapTasksafterPropertiesSet, cancelRemainingTask, destroy, getThreadPoolName, internalShutdown, setAwaitTerminationSeconds, setThreadPoolName, setWaitForTasksToCompleteOnShutdownallowCoreThreadTimeOut, allowsCoreThreadTimeOut, finalize, getActiveCount, getCompletedTaskCount, getKeepAliveTime, getLargestPoolSize, getQueue, getRejectedExecutionHandler, getTaskCount, getThreadFactory, isTerminating, prestartAllCoreThreads, prestartCoreThread, purge, remove, setKeepAliveTime, setMaximumPoolSize, setRejectedExecutionHandler, setThreadFactory, terminated, toStringinvokeAll, invokeAll, invokeAny, invokeAny, newTaskFor, newTaskForprotected final AtomicInteger count
protected final List<DtpExecutor> executors
public OrderedDtpExecutor(int corePoolSize,
int maximumPoolSize,
long keepAliveTime,
TimeUnit unit,
BlockingQueue<Runnable> workQueue)
public OrderedDtpExecutor(int corePoolSize,
int maximumPoolSize,
long keepAliveTime,
TimeUnit unit,
BlockingQueue<Runnable> workQueue,
ThreadFactory threadFactory)
public OrderedDtpExecutor(int corePoolSize,
int maximumPoolSize,
long keepAliveTime,
TimeUnit unit,
BlockingQueue<Runnable> workQueue,
RejectedExecutionHandler handler)
public OrderedDtpExecutor(int corePoolSize,
int maximumPoolSize,
long keepAliveTime,
TimeUnit unit,
BlockingQueue<Runnable> workQueue,
ThreadFactory threadFactory,
RejectedExecutionHandler handler)
public void execute(Runnable command)
ExecutorAdapterexecute 在接口中 ExecutorAdapter<ThreadPoolExecutor>execute 在接口中 Executorexecute 在接口中 org.springframework.core.task.TaskExecutorexecute 在类中 DtpExecutorcommand - the runnable taskpublic Future<?> submit(Runnable task)
submit 在接口中 ExecutorServicesubmit 在接口中 org.springframework.core.task.AsyncTaskExecutorsubmit 在类中 AbstractExecutorServicepublic <T> Future<T> submit(Runnable task, T result)
submit 在接口中 ExecutorServicesubmit 在类中 AbstractExecutorServicepublic <T> Future<T> submit(Callable<T> task)
submit 在接口中 ExecutorServicesubmit 在接口中 org.springframework.core.task.AsyncTaskExecutorsubmit 在类中 AbstractExecutorServiceprotected DtpExecutor choose(Object arg)
public void setCorePoolSize(int corePoolSize)
ExecutorAdaptersetCorePoolSize 在接口中 ExecutorAdapter<ThreadPoolExecutor>setCorePoolSize 在类中 ThreadPoolExecutorcorePoolSize - the core pool sizepublic int getCorePoolSize()
ExecutorAdaptergetCorePoolSize 在接口中 ExecutorAdapter<ThreadPoolExecutor>getCorePoolSize 在类中 ThreadPoolExecutorpublic final int getPoolSize()
ExecutorAdaptergetPoolSize 在接口中 ExecutorAdapter<ThreadPoolExecutor>getPoolSize 在类中 ThreadPoolExecutorpublic final int getMaximumPoolSize()
ExecutorAdaptergetMaximumPoolSize 在接口中 ExecutorAdapter<ThreadPoolExecutor>getMaximumPoolSize 在类中 ThreadPoolExecutorpublic void shutdown()
shutdown 在接口中 ExecutorServiceshutdown 在类中 ThreadPoolExecutorpublic List<Runnable> shutdownNow()
shutdownNow 在接口中 ExecutorServiceshutdownNow 在类中 ThreadPoolExecutorpublic boolean isShutdown()
isShutdown 在接口中 ExecutorServiceisShutdown 在类中 ThreadPoolExecutorpublic boolean isTerminated()
isTerminated 在接口中 ExecutorServiceisTerminated 在类中 ThreadPoolExecutorpublic boolean awaitTermination(long timeout,
TimeUnit unit)
throws InterruptedException
awaitTermination 在接口中 ExecutorServiceawaitTermination 在类中 ThreadPoolExecutorInterruptedExceptionCopyright © 2023. All rights reserved.