diff options
author | janakr <janakr@google.com> | 2017-11-21 05:45:25 -0800 |
---|---|---|
committer | Copybara-Service <copybara-piper@google.com> | 2017-11-21 05:47:21 -0800 |
commit | 34d02ef1a47cdb7847fdd12e96d7532dc7e0d7df (patch) | |
tree | f75cf9c6dded0dcb065dd165cc7c35605a5cafce /src/main/java/com/google/devtools/build/skyframe/AbstractParallelEvaluator.java | |
parent | 9bb93ee8c0edae911f9e2adeaca8aebd406788b6 (diff) |
Clear interrupted bit in thread when throwing an interrupted exception that came from an AbstractParallelEvaluator evaluation. It's against the standard Java contract to throw but still have the thread's interrupted bit set.
Also get rid of some unnecessary initializeTester() calls in MemoizingEvaluatorTest: we already call it via a @Before annotation.
PiperOrigin-RevId: 176496034
Diffstat (limited to 'src/main/java/com/google/devtools/build/skyframe/AbstractParallelEvaluator.java')
-rw-r--r-- | src/main/java/com/google/devtools/build/skyframe/AbstractParallelEvaluator.java | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/main/java/com/google/devtools/build/skyframe/AbstractParallelEvaluator.java b/src/main/java/com/google/devtools/build/skyframe/AbstractParallelEvaluator.java index 9884043170..8d1fab52b0 100644 --- a/src/main/java/com/google/devtools/build/skyframe/AbstractParallelEvaluator.java +++ b/src/main/java/com/google/devtools/build/skyframe/AbstractParallelEvaluator.java @@ -564,8 +564,9 @@ public abstract class AbstractParallelEvaluator { } void propagateInterruption(SchedulerException e) throws InterruptedException { + boolean mustThrowInterrupt = Thread.interrupted(); Throwables.propagateIfPossible(e.getCause(), InterruptedException.class); - if (Thread.interrupted()) { + if (mustThrowInterrupt) { // As per the contract of AbstractQueueVisitor#work, if an unchecked exception is thrown and // the build is interrupted, the thrown exception is what will be rethrown. Since the user // presumably wanted to interrupt the build, we ignore the thrown SchedulerException (which |