解决 rejected from java.util.concurrent.ThreadPoolExecutor@7342dc
时间:2022-10-23 22:30:00
解决方法:
ThreadPoolExecutor executor = new ThreadPoolExecutor(10, 50, 30*1000,TimeUnit.MILLISECONDS, new LinkedBlockingDeque
使用java.util.concurrent.ThreadPoolExecutor.execute(Runnable command)提交任务时,当线程池中使用的线程数达到设定的最大值(50),队列已经(1000)时,就会报错。
增加判断:
if (((ThreadPoolExecutor) taskExecutor).getActiveCount()<50){