I submitted bunch of jobs to an executorservice in Java and I somehow want to temporarily pause all these jobs. What's the best way to do this? How can I resume? Or am I doing this completely wrong? Should I follow some other pattern for what I want to achieve (i.e. ability to pause/resume execution services)?
Java ExecutorService – How to Pause and Resume All Threads
concurrencyexecutorservicejavamultithreadingparallel-processing
Best Answer
To answer my own question, I found an example of a
PausableThreadPoolExecutor
in the javadocs ofThreadPoolExecutor
itself. Here is my version using Guava's Monitors: