解决 rejected from java.util.concurrent.ThreadPoolExecutor@7342dc
解决方法:ThreadPoolExecutor executor = new ThreadPoolExecutor(10, 50, 30*1000,TimeUnit.MILLISECONDS, new LinkedBlockingDeque(1000));使用java.util.concurrent.ThreadPoolExecutor.execute(Runnable command)方法提交任
·
解决方法:
ThreadPoolExecutor executor = new ThreadPoolExecutor(10, 50, 30*1000,TimeUnit.MILLISECONDS, new LinkedBlockingDeque<Runnable>(1000));
使用java.util.concurrent.ThreadPoolExecutor.execute(Runnable command)方法提交任务时,当线程池中正在使用的线程数达到了设置的最大的值(50),而且队列已(1000),就会报错。
增加判断即可:
if (((ThreadPoolExecutor) taskExecutor).getActiveCount()<50){
更多推荐
所有评论(0)