具有无限队列的ThreadPoolExecutor不创建新线程 [英] ThreadPoolExecutor with unbounded queue not creating new threads
本文介绍了具有无限队列的ThreadPoolExecutor不创建新线程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的ThreadPoolExecutor
无法创建新线程.实际上,我写了一个有点怪异的LinkedBlockingQueue
,它将接受任何任务(即,它是不受限制的),但调用了一个附加处理程序-在我的应用程序中,它会发出警告跟踪表明该池已在后面-这为我提供了非常明确的信息,即TPE是即使队列中有成千上万的条目,也拒绝创建新线程.我的构造函数如下:
My ThreadPoolExecutor
is failing to create new threads. In fact I wrote a somewhat hacky LinkedBlockingQueue
that will accept any task (i.e. it is unbounded) but call an additional handler - which in my application spews warning trace that the pool is behind - which gives me very explicit information that the TPE is refusing to create new threads even though the queue has thousands of entries in it. My constructor is as follows:
private final ExecutorService s3UploadPool =
new ThreadPoolExecutor(1, 40, 1, TimeUnit.HOURS, unboundedLoggingQueue);
为什么不创建新线程?
推荐答案
查看全文