I want ScheduledThreadPoolExecutor to fail when the same job accumulates

Asked 2 months ago, Updated 2 months ago, 1 views

If I run a job regularly in ScheduledThreadPoolExecutor#scheduleAtFixedRate, if the job runs longer than the run interval, the next job execution will be delayed during that time, but if the previous job is not finished, can I stop the new job execution?Is it impossible if I don't create and control Mutex on the job side?

setlock-n as daemontools calls it.


2022-09-30 11:02

1 Answers

Could you check the number of stays with ScheduledThreadPoolExecutor #getQueue()#size()?

2022-09-30 11:02

If you have any answers or tips

© 2022 OneMinuteCode. All rights reserved.