aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Googler <noreply@google.com>2017-05-24 18:51:20 +0200
committerGravatar Irina Iancu <elenairina@google.com>2017-05-26 09:34:56 +0200
commitcf94053c3403297c18d75eca4a68560a1e131af5 (patch)
tree9b8abdc7a7939475fcfe37d75004fd9cb5351c47 /src
parentcf623c32ee369efbced6f1558eb07d5979213228 (diff)
Don't throw runtime exception on interruption - since we know the future is already done, we should leave the thread in an interrupted state and proceed. This fixes a blaze crash when a 'genquery' execution is interrupted at the right time.
PiperOrigin-RevId: 157000269
Diffstat (limited to 'src')
-rw-r--r--src/main/java/com/google/devtools/build/lib/query2/engine/AbstractQueryEnvironment.java6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/query2/engine/AbstractQueryEnvironment.java b/src/main/java/com/google/devtools/build/lib/query2/engine/AbstractQueryEnvironment.java
index 80ded4ffea..a078a4b7ad 100644
--- a/src/main/java/com/google/devtools/build/lib/query2/engine/AbstractQueryEnvironment.java
+++ b/src/main/java/com/google/devtools/build/lib/query2/engine/AbstractQueryEnvironment.java
@@ -24,7 +24,6 @@ import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.devtools.build.lib.query2.engine.QueryEnvironment.QueryTaskCallable;
import com.google.devtools.build.lib.query2.engine.QueryEnvironment.QueryTaskFuture;
-import com.google.devtools.build.lib.util.Preconditions;
import java.util.concurrent.CancellationException;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Executor;
@@ -84,10 +83,9 @@ public abstract class AbstractQueryEnvironment<T> implements QueryEnvironment<T>
@Override
public T getIfSuccessful() {
- Preconditions.checkState(delegate.isDone());
try {
- return delegate.get();
- } catch (CancellationException | InterruptedException | ExecutionException e) {
+ return Futures.getDone(delegate);
+ } catch (CancellationException | ExecutionException e) {
throw new IllegalStateException(e);
}
}