use of hudson.init.Terminator in project workflow-cps-plugin by jenkinsci.
the class CpsFlowExecution method suspendAll.
@Restricted(DoNotUse.class)
@Terminator
public static void suspendAll() {
CpsFlowExecution exec = null;
try (Timeout t = Timeout.limit(3, TimeUnit.MINUTES)) {
// TODO some complicated sequence of calls to Futures could allow all of them to run in parallel
LOGGER.fine("starting to suspend all executions");
for (FlowExecution execution : FlowExecutionList.get()) {
if (execution instanceof CpsFlowExecution) {
LOGGER.log(Level.FINE, "waiting to suspend {0}", execution);
exec = (CpsFlowExecution) execution;
// Like waitForSuspension but with a timeout:
if (exec.programPromise != null) {
exec.programPromise.get(1, TimeUnit.MINUTES).scheduleRun().get(1, TimeUnit.MINUTES);
}
}
}
LOGGER.fine("finished suspending all executions");
} catch (Exception x) {
LOGGER.log(Level.WARNING, "problem suspending " + exec, x);
}
}
Aggregations