aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/query2/BlazeQueryEnvironment.java
diff options
context:
space:
mode:
authorGravatar Nathan Harmata <nharmata@google.com>2016-09-28 20:20:48 +0000
committerGravatar Yun Peng <pcloudy@google.com>2016-09-29 09:03:54 +0000
commit71616b1549daee1eb5ec822c7bd1c744d8c58479 (patch)
treee14dccec7d5d009c9c6d90fa84606bf92fd620f4 /src/main/java/com/google/devtools/build/lib/query2/BlazeQueryEnvironment.java
parent5825a418ef66572f3073ff62d11d255baa5b975c (diff)
Make AbstractBlazeQueryEnvironment no longer implement AutoCloseable. Instead have SkyQueryEnvironment#evaluateQuery be responsible for handling cleanup of its internal ForkJoinPool.
In addition to being a more sensible way of organizing the code (imo, it makes sense for SkyQueryEnvironment to clean up after itself), this fixes several issues: (i) If query evaluation is interrupted, the AbstractBlazeQueryEnvironment#close call at the end of the try-with-resources statement in QueryCommand would be blocking and non-urgent. N.B. This was not an issue with the current ForkJoinPool usage, but was an issue with the old ThreadPoolExecutor usage. (ii) Because of how the code in QueryCommand was structured, OutputFormatterCallback#close would happen _before_ the AbstractBlazeQueryEnvironment#close call. If query evaluation is interrupted, threads executing query tasks may be invoking the callback after the callback had been shut down! -- MOS_MIGRATED_REVID=134573395
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/query2/BlazeQueryEnvironment.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/query2/BlazeQueryEnvironment.java7
1 files changed, 0 insertions, 7 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/query2/BlazeQueryEnvironment.java b/src/main/java/com/google/devtools/build/lib/query2/BlazeQueryEnvironment.java
index 1b1749fe08..2b8c3e602f 100644
--- a/src/main/java/com/google/devtools/build/lib/query2/BlazeQueryEnvironment.java
+++ b/src/main/java/com/google/devtools/build/lib/query2/BlazeQueryEnvironment.java
@@ -109,13 +109,6 @@ public class BlazeQueryEnvironment extends AbstractBlazeQueryEnvironment<Target>
this.labelVisitor = new LabelVisitor(packageProvider, dependencyFilter);
}
- /**
- * Calling close is optional because {@link BlazeQueryEnvironment} has no resources that need
- * manual management.
- */
- @Override
- public void close() {}
-
@Override
public DigraphQueryEvalResult<Target> evaluateQuery(QueryExpression expr,
final Callback<Target> callback) throws QueryException, InterruptedException {