Skip to content
Permalink
Browse files

[FXED JENKINS-25921] scheduleRun should not throw RejectedExecutionEx…

…ception simply because the flow is complete.

Originally-Committed-As: 121d07f1e182f3d17a9257de79dcadb0cb5d67f5
  • Loading branch information
jglick committed Dec 4, 2014
1 parent c327ece commit fb0ee2a6c8ce84137b2fbacea52c14a601678c2e
Showing with 6 additions and 1 deletion.
  1. +6 −1 cps/src/main/java/org/jenkinsci/plugins/workflow/cps/CpsThreadGroup.java
@@ -169,7 +169,9 @@ public void unexport(BodyReference ref) {
* Schedules the execution of all the runnable threads.
*/
public Future<?> scheduleRun() {
final Future<Future<?>> f = runner.submit(new Callable<Future<?>>() {
final Future<Future<?>> f;
try {
f = runner.submit(new Callable<Future<?>>() {
public Future<?> call() throws Exception {
run();
// we ensure any tasks submitted during run() will complete before we declare us complete
@@ -190,6 +192,9 @@ public void unexport(BodyReference ref) {
}
}
});
} catch (RejectedExecutionException x) {
return Futures.immediateFuture(null);
}

// unfortunately that means we have to wait for Future of Future,
// so we need a rather unusual implementation of Future to hide that behind the scene.

0 comments on commit fb0ee2a

Please sign in to comment.