diff options
author | Mark Schaller <mschaller@google.com> | 2015-11-02 17:07:29 +0000 |
---|---|---|
committer | David Chen <dzc@google.com> | 2015-11-02 23:18:53 +0000 |
commit | 96f789448481eb7a981ed76c344c42042b3c30cb (patch) | |
tree | 9e6582a8e677f3fcc8e2e2b31c12b85f4fed98fc /src/main/java/com/google/devtools/build/lib/concurrent | |
parent | 29375d405399a2d39b42c853849e39cb82048c19 (diff) |
Cleanup ValueVisitor (and dirty QuiescingExecutor)
Raises the level of abstraction of ValueVisitor's dependence on
AbstractQueueVisitor. Except for the "ForTestingOnly" methods now
available on the QuiescingExecutor interface, ValueVisitor is
agnostic to the implementation of its executor.
This also cleans up the full spectrum of visibility modifiers on
ValueVisitor methods, all of which ought to be private.
--
MOS_MIGRATED_REVID=106847453
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/concurrent')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/concurrent/AbstractQueueVisitor.java | 9 | ||||
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/concurrent/QuiescingExecutor.java | 11 |
2 files changed, 11 insertions, 9 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/concurrent/AbstractQueueVisitor.java b/src/main/java/com/google/devtools/build/lib/concurrent/AbstractQueueVisitor.java index d5b6f1a7e9..b082bf20a9 100644 --- a/src/main/java/com/google/devtools/build/lib/concurrent/AbstractQueueVisitor.java +++ b/src/main/java/com/google/devtools/build/lib/concurrent/AbstractQueueVisitor.java @@ -574,15 +574,6 @@ public class AbstractQueueVisitor implements QuiescingExecutor { return (failFastOnInterrupt && isInterrupted()) || (unhandled != null && failFastOnException); } - /** - * Await interruption. Used only in tests. - */ - @VisibleForTesting - public boolean awaitInterruptionForTestingOnly(long timeout, TimeUnit units) - throws InterruptedException { - return interruptedLatch.await(timeout, units); - } - /** Get latch that is released when exception is received by visitor. Used only in tests. */ @VisibleForTesting public CountDownLatch getExceptionLatchForTestingOnly() { diff --git a/src/main/java/com/google/devtools/build/lib/concurrent/QuiescingExecutor.java b/src/main/java/com/google/devtools/build/lib/concurrent/QuiescingExecutor.java index 721c47a714..65718c6205 100644 --- a/src/main/java/com/google/devtools/build/lib/concurrent/QuiescingExecutor.java +++ b/src/main/java/com/google/devtools/build/lib/concurrent/QuiescingExecutor.java @@ -13,6 +13,9 @@ // limitations under the License. package com.google.devtools.build.lib.concurrent; +import com.google.common.annotations.VisibleForTesting; + +import java.util.concurrent.CountDownLatch; import java.util.concurrent.Executor; /** @@ -49,4 +52,12 @@ public interface QuiescingExecutor extends Executor { * If false, just wait for them to terminate normally. */ void awaitQuiescence(boolean interruptWorkers) throws InterruptedException; + + /** Get latch that is released if a task throws an exception. Used only in tests. */ + @VisibleForTesting + CountDownLatch getExceptionLatchForTestingOnly(); + + /** Get latch that is released if a task is interrupted. Used only in tests. */ + @VisibleForTesting + CountDownLatch getInterruptionLatchForTestingOnly(); } |