Tom Tucker
Tom Tucker

Reputation: 11896

Putting Scheduled Tasks on Hold with ScheduledThreadPoolExecutor

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

Answers (2)

John Kane
John Kane

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

paulk23
paulk23

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

Related Questions