Java线程池异常往外抛,线程池异常:.RejectedExecutionException

如下所示,线程已经没有任务了,一直出现该异常;求解。

spring.thread.pool.corePoolSize=10

spring.thread.pool.maxPoolSize=100

spring.thread.pool.keepAliveSeconds=300

spring.thread.pool.queueCapacity=200

spring.thread.pool.threadNamePrefix=AbilityExecutor

问题定位到这一行: 其中,mod = 4

for(int i=0;i

calls.add(new TicketArchiveCallable(idleSleep,

pooltimeout,topic+String.valueOf(i),props,ticketTransferService,cacheCapCodeService,rzLines,serilNumbePath));

}

CompletionService completionService=null;

try {

completionService = new ExecutorCompletionService(

executorService);

List> futures=new ArrayList();

for (int i = 0; i < calls.size(); i++) {

//异常提示在这一行

futures.add(completionService.submit(calls.get(i)));

}

java.util.concurrent.RejectedExecutionException: Task java.util.concurrent.ExecutorCompletionService$QueueingFuture@47a627cc rejected from java.util.concurrent.ThreadPoolExecutor@5acbef42[Terminated, pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 4]

at java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution(ThreadPoolExecutor.java:2063) ~[?:1.8.0_144]

at java.util.concurrent.ThreadPoolExecutor.reject(ThreadPoolExecutor.java:830) ~[?:1.8.0_144]

at java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:1379) ~[?:1.8.0_144]

at java.util.concurrent.ExecutorCompletionService.submit(ExecutorCompletionService.java:181) ~[?:1.8.0_144]

at com.aspire.ability.file.job.NewTicketArchiveJob.run(NewTicketArchiveJob.java:150) [Ability-Work-1.0.1-OnLine-File.jar:1.0.1-OnLine]

at sun.reflect.GeneratedMethodAccessor261.invoke(Unknown Source) ~[?:?]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_144]

at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_144]

at org.springframework.scheduling.support.ScheduledMethodRunnable.run(ScheduledMethodRunnable.java:65) [spring-context-4.3.7.RELEASE.jar:4.3.7.RELEASE]

at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54) [spring-context-4.3.7.RELEASE.jar:4.3.7.RELEASE]

at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_144]

at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) [?:1.8.0_144]

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值