Skip to content

Commit

Permalink
[FXED JENKINS-25921] scheduleRun should not throw RejectedExecutionEx…
Browse files Browse the repository at this point in the history
…ception simply because the flow is complete.

Originally-Committed-As: 121d07f1e182f3d17a9257de79dcadb0cb5d67f5
  • Loading branch information
jglick committed Dec 4, 2014
1 parent c327ece commit fb0ee2a
Showing 1 changed file with 6 additions and 1 deletion.
Expand Up @@ -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
Expand All @@ -190,6 +192,9 @@ public Future<?> call() throws Exception {
}
}
});
} 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.
Expand Down

0 comments on commit fb0ee2a

Please sign in to comment.