diff options
author | Janak Ramakrishnan <janakr@google.com> | 2016-08-16 15:14:41 +0000 |
---|---|---|
committer | Philipp Wollermann <philwo@google.com> | 2016-08-17 11:23:45 +0000 |
commit | 71cdea44161e70215e9816ebdc2f559bad658822 (patch) | |
tree | de724dbcb1dea85f69a9fbfa84af64c02c28c541 /src/main/java/com/google/devtools/build/lib | |
parent | 7c63f15e516f240b3ecc1642ae717e3b029dcfa6 (diff) |
In BlazeQueryEnvironment, stop wrapping InterruptedExceptions in QueryExceptions now that all relevant methods declare that they throw InterruptedException.
Small side benefit of commit 3c0adb26bac6d756fb97e4bcc6d4e5b2cefa5eeb.
--
MOS_MIGRATED_REVID=130402917
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/query2/AbstractBlazeQueryEnvironment.java | 8 | ||||
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/query2/BlazeQueryEnvironment.java | 43 |
2 files changed, 18 insertions, 33 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/query2/AbstractBlazeQueryEnvironment.java b/src/main/java/com/google/devtools/build/lib/query2/AbstractBlazeQueryEnvironment.java index 5df559945e..769bdb29bd 100644 --- a/src/main/java/com/google/devtools/build/lib/query2/AbstractBlazeQueryEnvironment.java +++ b/src/main/java/com/google/devtools/build/lib/query2/AbstractBlazeQueryEnvironment.java @@ -194,12 +194,12 @@ public abstract class AbstractBlazeQueryEnvironment<T> } /** - * Perform any work that should be done ahead of time to resolve the target patterns in the - * query. Implementations may choose to cache the results of resolving the patterns, cache - * intermediate work, or not cache and resolve patterns on the fly. + * Perform any work that should be done ahead of time to resolve the target patterns in the query. + * Implementations may choose to cache the results of resolving the patterns, cache intermediate + * work, or not cache and resolve patterns on the fly. */ protected abstract void preloadOrThrow(QueryExpression caller, Collection<String> patterns) - throws QueryException, TargetParsingException; + throws QueryException, TargetParsingException, InterruptedException; @Override public boolean isSettingEnabled(Setting setting) { 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 ad6b54002a..65b853b473 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 @@ -185,29 +185,22 @@ public class BlazeQueryEnvironment extends AbstractBlazeQueryEnvironment<Target> } } catch (NoSuchThingException e) { /* ignore */ - } catch (InterruptedException e) { - throw new QueryException("interrupted"); } } } } - try { - callback.process(result); - } catch (InterruptedException e) { - throw new QueryException(caller, e.getMessage()); - } + callback.process(result); } @Override - public Target getTarget(Label label) throws TargetNotFoundException, QueryException { + public Target getTarget(Label label) + throws TargetNotFoundException, QueryException, InterruptedException { // Can't use strictScope here because we are expecting a target back. validateScope(label, true); try { return getNode(getTargetOrThrow(label)).getLabel(); } catch (NoSuchThingException e) { throw new TargetNotFoundException(e); - } catch (InterruptedException e) { - throw new QueryException("interrupted"); } } @@ -309,16 +302,13 @@ public class BlazeQueryEnvironment extends AbstractBlazeQueryEnvironment<Target> }; } - private void preloadTransitiveClosure(Set<Target> targets, int maxDepth) throws QueryException { + private void preloadTransitiveClosure(Set<Target> targets, int maxDepth) + throws QueryException, InterruptedException { if (maxDepth >= MAX_DEPTH_FULL_SCAN_LIMIT && transitivePackageLoader != null) { // Only do the full visitation if "maxDepth" is large enough. Otherwise, the benefits of // preloading will be outweighed by the cost of doing more work than necessary. - try { - transitivePackageLoader.sync(eventHandler, targets, ImmutableSet.<Label>of(), keepGoing, - loadingPhaseThreads, -1); - } catch (InterruptedException e) { - throw new QueryException("interrupted"); - } + transitivePackageLoader.sync( + eventHandler, targets, ImmutableSet.<Label>of(), keepGoing, loadingPhaseThreads, -1); } } @@ -426,19 +416,14 @@ public class BlazeQueryEnvironment extends AbstractBlazeQueryEnvironment<Target> @Override protected void preloadOrThrow(QueryExpression caller, Collection<String> patterns) - throws TargetParsingException { + throws TargetParsingException, InterruptedException { if (!resolvedTargetPatterns.keySet().containsAll(patterns)) { - try { - // Note that this may throw a RuntimeException if deps are missing in Skyframe and this is - // being called from within a SkyFunction. - resolvedTargetPatterns.putAll( - Maps.transformValues( - targetPatternEvaluator.preloadTargetPatterns(eventHandler, patterns, keepGoing), - RESOLVED_TARGETS_TO_TARGETS)); - } catch (InterruptedException e) { - // TODO(bazel-team): Propagate the InterruptedException from here [skyframe-loading]. - throw new TargetParsingException("interrupted"); - } + // Note that this may throw a RuntimeException if deps are missing in Skyframe and this is + // being called from within a SkyFunction. + resolvedTargetPatterns.putAll( + Maps.transformValues( + targetPatternEvaluator.preloadTargetPatterns(eventHandler, patterns, keepGoing), + RESOLVED_TARGETS_TO_TARGETS)); } } |