From 71cdea44161e70215e9816ebdc2f559bad658822 Mon Sep 17 00:00:00 2001 From: Janak Ramakrishnan Date: Tue, 16 Aug 2016 15:14:41 +0000 Subject: 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 --- .../lib/query2/AbstractBlazeQueryEnvironment.java | 8 ++-- .../build/lib/query2/BlazeQueryEnvironment.java | 43 +++++++--------------- 2 files changed, 18 insertions(+), 33 deletions(-) (limited to 'src/main/java/com/google/devtools/build/lib/query2') 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 } /** - * 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 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 } } 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 }; } - private void preloadTransitiveClosure(Set targets, int maxDepth) throws QueryException { + private void preloadTransitiveClosure(Set 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.