In SchedulingMonitor.java, when the service starts, it starts a checker thread to perform Capacity Scheduler's preemption. However, the implementation of this checker thread has the following issue:
The above code snippet will terminate the checker thread whenever it is interrupted.
We noticed in our cluster that this could lead to CapacityScheduler's preemption disabled unexpectedly due to the checker thread getting terminated.
We propose to use ScheduledExecutorService to improve the robustness of this part of the code to ensure the liveness of CapacityScheduler's preemption functionality.