Skip to content

Commit 72bd535

Browse files
committed
Call CpsVmExecutorService.shutdown from CpsFlowExecution.suspendAll
1 parent 8732e31 commit 72bd535

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed

src/main/java/org/jenkinsci/plugins/workflow/cps/CpsFlowExecution.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1584,6 +1584,15 @@ public void pause(final boolean v) throws IOException {
15841584
}
15851585
}
15861586
cpsExec.checkpoint(true);
1587+
cpsExec.runInCpsVmThread(new FutureCallback<CpsThreadGroup>() {
1588+
@Override public void onSuccess(CpsThreadGroup g) {
1589+
LOGGER.fine(() -> "shutting down CPS VM threadin for " + cpsExec);
1590+
g.shutdown();
1591+
}
1592+
@Override public void onFailure(Throwable t) {
1593+
LOGGER.log(Level.WARNING, null, t);
1594+
}
1595+
});
15871596
}
15881597
} catch (Exception ex) {
15891598
LOGGER.log(Level.WARNING, "Error persisting Pipeline execution at shutdown: "+((CpsFlowExecution) execution).owner, ex);

src/main/java/org/jenkinsci/plugins/workflow/cps/CpsStepContext.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -436,12 +436,9 @@ public void onSuccess(CpsThreadGroup g) {
436436
}
437437
outcome = new Outcome(null, new AlreadyCompleted());
438438
}
439-
440-
/**
441-
* Program state failed to load.
442-
*/
443439
@Override
444440
public void onFailure(Throwable t) {
441+
LOGGER.log(Level.WARNING, "Failed to proceed after " + CpsStepContext.this, t);
445442
}
446443
});
447444
} catch (IOException x) {

src/main/java/org/jenkinsci/plugins/workflow/cps/CpsThreadGroup.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -640,6 +640,10 @@ private void propagateErrorToWorkflow(Throwable t) {
640640
}
641641
}
642642

643+
void shutdown() {
644+
runner.shutdown();
645+
}
646+
643647
private static final Logger LOGGER = Logger.getLogger(CpsThreadGroup.class.getName());
644648

645649
private static final long serialVersionUID = 1L;

0 commit comments

Comments
 (0)