I have a thread pool created using
java.util.concurrent.ThreadPoolExecutor
Anyway, can I wait until the pool is idle? By this, I mean that all threads are down and waiting in the queue for nothing.
I searched on the internet and all solutions do not work for me. For example, I do not want to disable the pool, so waitTermination () will not work. I also know how to getTaskCount (), but I do not want to continue polling the pool that the processor drops.
This is a big project, and I donβt want to change all the tasks running in the pool, so I'm looking for some solution that does not depend on the collaboration of the task. So latches or barriers don't work for me.
source share