I have a ThreadPoolExecutor
with a fixed core pool size and a LinkedBlockingQueue
for thread pool tasks that have to wait if the entire core is busy.
Assuming that all core threads are currently busy and there are further tasks enqueued into the queue that are waiting for their future execution.
I'd like to detect the queue position of a specific task which is currently waiting. It's possible to access all queue items via ThreadPoolExecutor.getQueue().toArray()
but the items are all instances of FutureTask
. I cannot access the contained Callable
member which would provide enough information for an identification of my concrete task which I'm looking for.
Is there an existing mechanism or approach to detect the position of a wanted task which is currently queued?