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.DiscardPolicy| 限定符和类型 | 字段和说明 |
|---|---|
protected AtomicInteger |
count |
protected List<DtpExecutor> |
executors |
awaitTerminationSeconds, threadPoolName, waitForTasksToCompleteOnShutdown| 构造器和说明 |
|---|
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) |
int |
getCorePoolSize() |
int |
getMaximumPoolSize() |
int |
getPoolSize() |
boolean |
isShutdown() |
boolean |
isTerminated() |
void |
setCorePoolSize(int corePoolSize) |
void |
setMaximumPoolSize(int maximumPoolSize) |
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, getQueueCapacity, getQueueName, getQueueTimeoutCount, getRejectCount, getRejectHandlerName, getRunTimeoutCount, getThreadPoolAliasName, incRejectCount, initialize, isNotifyEnabled, setAllowCoreThreadTimeOut, setNotifyEnabled, setNotifyItems, setPreStartAllCoreThreads, setQueueTimeout, setRejectHandlerName, setRunTimeout, setTaskWrappers, setThreadPoolAliasNameafterPropertiesSet, cancelRemainingTask, destroy, getThreadPoolName, internalShutdown, setAwaitTerminationSeconds, setThreadPoolName, setWaitForTasksToCompleteOnShutdownallowCoreThreadTimeOut, allowsCoreThreadTimeOut, finalize, getActiveCount, getCompletedTaskCount, getKeepAliveTime, getLargestPoolSize, getQueue, getRejectedExecutionHandler, getTaskCount, getThreadFactory, isTerminating, prestartAllCoreThreads, prestartCoreThread, purge, remove, setKeepAliveTime, 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,
ThreadFactory threadFactory,
RejectedExecutionHandler handler)
public void execute(Runnable command)
execute 在接口中 Executorexecute 在接口中 org.springframework.core.task.TaskExecutorexecute 在类中 DtpExecutorpublic 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)
setCorePoolSize 在类中 ThreadPoolExecutorpublic int getCorePoolSize()
getCorePoolSize 在类中 ThreadPoolExecutorpublic final void setMaximumPoolSize(int maximumPoolSize)
setMaximumPoolSize 在类中 ThreadPoolExecutorpublic final int getPoolSize()
getPoolSize 在类中 ThreadPoolExecutorpublic final int getMaximumPoolSize()
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.