Reputation: 11896
Can ScheduledThreadPoolExecutor
put scheduled tasks on hold that have not yet started?
I don't want to cancel them, but just put them on hold if some situation arises and then resume them once the situation is resolved.
If this function is not supported, is there any library out there that supports it?
Upvotes: 3
Views: 156
Reputation: 4443
One simple thing that you could do is create a queue of tasks to be executed. Then pull from the queue when you are not blocking.
Upvotes: 1
Reputation: 465
Have a look at the Quartz library. You can use it to schedule jobs and it does have pause / resume capability for those jobs. Have a look at this thread for some related discussion: Quartz - resuming a job
Upvotes: 1