aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/skyframe
diff options
context:
space:
mode:
authorGravatar Mark Schaller <mschaller@google.com>2015-10-13 20:06:19 +0000
committerGravatar Florian Weikert <fwe@google.com>2015-10-13 21:13:27 +0000
commiteff2b450bd44d019d3b23495e383cfce9e473fe6 (patch)
tree5ed1e0fffae45eee1153d7c36b34782cac76ab83 /src/main/java/com/google/devtools/build/skyframe
parent5a9b69919927ee076ca0817da3489e43eb88d338 (diff)
Allow other ExecutorService implementations in AbstractQueueVisitor
Previously, only ThreadPoolExecutor implementations were allowed. -- MOS_MIGRATED_REVID=105340237
Diffstat (limited to 'src/main/java/com/google/devtools/build/skyframe')
-rw-r--r--src/main/java/com/google/devtools/build/skyframe/EagerInvalidator.java19
-rw-r--r--src/main/java/com/google/devtools/build/skyframe/InvalidatingNodeVisitor.java11
-rw-r--r--src/main/java/com/google/devtools/build/skyframe/ParallelEvaluator.java1
3 files changed, 9 insertions, 22 deletions
diff --git a/src/main/java/com/google/devtools/build/skyframe/EagerInvalidator.java b/src/main/java/com/google/devtools/build/skyframe/EagerInvalidator.java
index be6cf81310..ce76bc6996 100644
--- a/src/main/java/com/google/devtools/build/skyframe/EagerInvalidator.java
+++ b/src/main/java/com/google/devtools/build/skyframe/EagerInvalidator.java
@@ -15,12 +15,12 @@ package com.google.devtools.build.skyframe;
import com.google.common.base.Function;
import com.google.devtools.build.lib.concurrent.AbstractQueueVisitor;
-import com.google.devtools.build.lib.concurrent.ThreadPoolExecutorParams;
+import com.google.devtools.build.lib.concurrent.ExecutorParams;
import com.google.devtools.build.skyframe.InvalidatingNodeVisitor.DeletingNodeVisitor;
import com.google.devtools.build.skyframe.InvalidatingNodeVisitor.DirtyingNodeVisitor;
import com.google.devtools.build.skyframe.InvalidatingNodeVisitor.InvalidationState;
-import java.util.concurrent.ThreadPoolExecutor;
+import java.util.concurrent.ExecutorService;
import javax.annotation.Nullable;
@@ -73,24 +73,13 @@ public final class EagerInvalidator {
EvaluationProgressReceiver invalidationReceiver,
InvalidationState state,
DirtyKeyTracker dirtyKeyTracker,
- Function<ThreadPoolExecutorParams, ThreadPoolExecutor> executorFactory) {
+ Function<ExecutorParams, ? extends ExecutorService> executorFactory) {
state.update(diff);
return state.isEmpty() ? null
: new DirtyingNodeVisitor(graph, invalidationReceiver, state, dirtyKeyTracker,
executorFactory);
}
- @Nullable
- static DirtyingNodeVisitor createInvalidatingVisitorIfNeeded(
- DirtiableGraph graph,
- Iterable<SkyKey> diff,
- EvaluationProgressReceiver invalidationReceiver,
- InvalidationState state,
- DirtyKeyTracker dirtyKeyTracker) {
- return createInvalidatingVisitorIfNeeded(graph, diff, invalidationReceiver, state,
- dirtyKeyTracker, AbstractQueueVisitor.EXECUTOR_FACTORY);
- }
-
/**
* Invalidates given values and their upward transitive closure in the graph, using an executor
* constructed with the provided factory, if necessary.
@@ -101,7 +90,7 @@ public final class EagerInvalidator {
EvaluationProgressReceiver invalidationReceiver,
InvalidationState state,
DirtyKeyTracker dirtyKeyTracker,
- Function<ThreadPoolExecutorParams, ThreadPoolExecutor> executorFactory)
+ Function<ExecutorParams, ? extends ExecutorService> executorFactory)
throws InterruptedException {
// If we are invalidating, we must be in an incremental build by definition, so we must
// maintain a consistent graph state by traversing the graph and invalidating transitive
diff --git a/src/main/java/com/google/devtools/build/skyframe/InvalidatingNodeVisitor.java b/src/main/java/com/google/devtools/build/skyframe/InvalidatingNodeVisitor.java
index 2b4fa85c71..459c7ffc7d 100644
--- a/src/main/java/com/google/devtools/build/skyframe/InvalidatingNodeVisitor.java
+++ b/src/main/java/com/google/devtools/build/skyframe/InvalidatingNodeVisitor.java
@@ -21,13 +21,13 @@ import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Iterables;
import com.google.common.collect.Sets;
import com.google.devtools.build.lib.concurrent.AbstractQueueVisitor;
-import com.google.devtools.build.lib.concurrent.ThreadPoolExecutorParams;
+import com.google.devtools.build.lib.concurrent.ExecutorParams;
import com.google.devtools.build.lib.concurrent.ThreadSafety.ThreadSafe;
import com.google.devtools.build.lib.util.Pair;
import java.util.Map;
import java.util.Set;
-import java.util.concurrent.ThreadPoolExecutor;
+import java.util.concurrent.ExecutorService;
import java.util.concurrent.TimeUnit;
import javax.annotation.Nullable;
@@ -80,10 +80,9 @@ public abstract class InvalidatingNodeVisitor<TGraph extends ThinNodeQueryableGr
@Nullable EvaluationProgressReceiver invalidationReceiver,
InvalidationState state,
DirtyKeyTracker dirtyKeyTracker,
- Function<ThreadPoolExecutorParams, ThreadPoolExecutor> executorFactory) {
+ Function<ExecutorParams, ? extends ExecutorService> executorFactory) {
super(/*concurrent=*/true,
- /*corePoolSize=*/DEFAULT_THREAD_COUNT,
- /*maxPoolSize=*/DEFAULT_THREAD_COUNT,
+ /*parallelism=*/DEFAULT_THREAD_COUNT,
/*keepAliveTime=*/1,
/*units=*/TimeUnit.SECONDS,
/*failFastOnException=*/true,
@@ -298,7 +297,7 @@ public abstract class InvalidatingNodeVisitor<TGraph extends ThinNodeQueryableGr
EvaluationProgressReceiver invalidationReceiver,
InvalidationState state,
DirtyKeyTracker dirtyKeyTracker,
- Function<ThreadPoolExecutorParams, ThreadPoolExecutor> executorFactory) {
+ Function<ExecutorParams, ? extends ExecutorService> executorFactory) {
super(graph, invalidationReceiver, state, dirtyKeyTracker, executorFactory);
}
diff --git a/src/main/java/com/google/devtools/build/skyframe/ParallelEvaluator.java b/src/main/java/com/google/devtools/build/skyframe/ParallelEvaluator.java
index fc54c1f8fd..59ff33ad48 100644
--- a/src/main/java/com/google/devtools/build/skyframe/ParallelEvaluator.java
+++ b/src/main/java/com/google/devtools/build/skyframe/ParallelEvaluator.java
@@ -600,7 +600,6 @@ public final class ParallelEvaluator implements Evaluator {
private ValueVisitor(int threadCount) {
super(/*concurrent*/true,
threadCount,
- threadCount,
1, TimeUnit.SECONDS,
/*failFastOnException*/true,
/*failFastOnInterrupt*/true,