I have an executor who is responsible for consuming messages from ArrayBlockingQueue.
new ThreadPoolExecutor(1, 1, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>(1), r -> { return new Thread(r, "Request-Queue-Drainer"); });
The request-queue-drainage flow is in the WAITING state (although tasks are transferred to this thread). The following is a stream dump.
Name: Request-Queue-Drainer State: WAITING on java.u til.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject@ 5b4757a2 Total blocked: 0 Total waited: 8 Stack trace: sun.misc.Unsafe.park(Native Method) java.util.concurrent.locks.LockSupport.park(LockSupport.java:175) java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2039) java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:442) java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1067) java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1127) java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) java.lang.Thread.run(Thread.java:745)
What could be the reason that the thread is idle?
source share