【发布时间】:2018-10-31 14:07:57
【问题描述】:
我在这里定义了一个Executor:
@Bean("asyncExecutor")
@Override
public Executor getAsyncExecutor() {
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
executor.setCorePoolSize(appConfigProperties.getThreadpoolCorePoolSize());
executor.setMaxPoolSize(appConfigProperties.getThreadpoolMaxPoolSize());
executor.setQueueCapacity(appConfigProperties.getThreadpoolQueueCapacity());
executor.setThreadNamePrefix("threadPoolExecutor-");
executor.initialize();
return executor;
}
我希望能够删除在队列中停留超过 X 分钟(未处理 X 分钟)的任务
有没有简单的方法来做到这一点?我找不到。
【问题讨论】:
标签: java executor spring-async