Make AbstractBlazeQueryEnv closable, shutdown SkyQEnv executor on close
Users of SkyQueryEnvironment ought to be able to shut down its executor
when they're finished with it.
RELNOTES: None.
PiperOrigin-RevId: 162262117
diff --git a/src/main/java/com/google/devtools/build/lib/query2/SkyQueryEnvironment.java b/src/main/java/com/google/devtools/build/lib/query2/SkyQueryEnvironment.java
index db78d71..fe54c4d 100644
--- a/src/main/java/com/google/devtools/build/lib/query2/SkyQueryEnvironment.java
+++ b/src/main/java/com/google/devtools/build/lib/query2/SkyQueryEnvironment.java
@@ -232,6 +232,14 @@
PrepareDepsOfPatternsFunction.getSkyKeys(universeKey, eventHandler));
}
+ @Override
+ public void close() {
+ if (executor != null) {
+ executor.shutdownNow();
+ executor = null;
+ }
+ }
+
private void beforeEvaluateQuery() throws InterruptedException {
if (graph == null || !graphFactory.isUpToDate(universeKey)) {
// If this environment is uninitialized or the graph factory needs to evaluate, do so. We