diff options
author | 2015-09-29 23:38:22 +0000 | |
---|---|---|
committer | 2015-09-30 09:36:30 +0000 | |
commit | 8efb2806c99c35d1a4e4e5527b2719798e15c4c8 (patch) | |
tree | 9bb77e8968204932d9b14e5cf3eedb6258455ca9 /src/main/java/com/google | |
parent | b51251ed0df121b50fba315d4eee17fa40049e83 (diff) |
Refactoring: Move ThreadPoolExecutorParams to top-level.
--
MOS_MIGRATED_REVID=104250152
Diffstat (limited to 'src/main/java/com/google')
4 files changed, 67 insertions, 47 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 4cdf0518f4..fe010c860a 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 @@ -54,52 +54,6 @@ import java.util.concurrent.atomic.AtomicBoolean; public class AbstractQueueVisitor { /** - * Configuration parameters for {@link ThreadPoolExecutor} construction. - */ - public static class ThreadPoolExecutorParams { - private final int corePoolSize; - private final int maxPoolSize; - private final long keepAliveTime; - private final TimeUnit units; - private final String poolName; - private final BlockingQueue<Runnable> workQueue; - - public ThreadPoolExecutorParams(int corePoolSize, int maxPoolSize, long keepAliveTime, - TimeUnit units, String poolName, BlockingQueue<Runnable> workQueue) { - this.corePoolSize = corePoolSize; - this.maxPoolSize = maxPoolSize; - this.keepAliveTime = keepAliveTime; - this.units = units; - this.poolName = poolName; - this.workQueue = workQueue; - } - - public int getCorePoolSize() { - return corePoolSize; - } - - public int getMaxPoolSize() { - return maxPoolSize; - } - - public long getKeepAliveTime() { - return keepAliveTime; - } - - public TimeUnit getUnits() { - return units; - } - - public String getPoolName() { - return poolName; - } - - public BlockingQueue<Runnable> getWorkQueue() { - return workQueue; - } - } - - /** * Default factory function for constructing {@link ThreadPoolExecutor}s. */ public static final Function<ThreadPoolExecutorParams, ThreadPoolExecutor> EXECUTOR_FACTORY = diff --git a/src/main/java/com/google/devtools/build/lib/concurrent/ThreadPoolExecutorParams.java b/src/main/java/com/google/devtools/build/lib/concurrent/ThreadPoolExecutorParams.java new file mode 100644 index 0000000000..b19b29aa4e --- /dev/null +++ b/src/main/java/com/google/devtools/build/lib/concurrent/ThreadPoolExecutorParams.java @@ -0,0 +1,65 @@ +// Copyright 2014 The Bazel Authors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package com.google.devtools.build.lib.concurrent; + +import java.util.concurrent.BlockingQueue; +import java.util.concurrent.ThreadPoolExecutor; +import java.util.concurrent.TimeUnit; + +/** + * Configuration parameters for {@link ThreadPoolExecutor} construction. + */ +public class ThreadPoolExecutorParams { + private final int corePoolSize; + private final int maxPoolSize; + private final long keepAliveTime; + private final TimeUnit units; + private final String poolName; + private final BlockingQueue<Runnable> workQueue; + + public ThreadPoolExecutorParams(int corePoolSize, int maxPoolSize, long keepAliveTime, + TimeUnit units, String poolName, BlockingQueue<Runnable> workQueue) { + this.corePoolSize = corePoolSize; + this.maxPoolSize = maxPoolSize; + this.keepAliveTime = keepAliveTime; + this.units = units; + this.poolName = poolName; + this.workQueue = workQueue; + } + + public int getCorePoolSize() { + return corePoolSize; + } + + public int getMaxPoolSize() { + return maxPoolSize; + } + + public long getKeepAliveTime() { + return keepAliveTime; + } + + public TimeUnit getUnits() { + return units; + } + + public String getPoolName() { + return poolName; + } + + public BlockingQueue<Runnable> getWorkQueue() { + return workQueue; + } +} 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 9a37d65d2e..be6cf81310 100644 --- a/src/main/java/com/google/devtools/build/skyframe/EagerInvalidator.java +++ b/src/main/java/com/google/devtools/build/skyframe/EagerInvalidator.java @@ -15,7 +15,7 @@ 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.AbstractQueueVisitor.ThreadPoolExecutorParams; +import com.google.devtools.build.lib.concurrent.ThreadPoolExecutorParams; import com.google.devtools.build.skyframe.InvalidatingNodeVisitor.DeletingNodeVisitor; import com.google.devtools.build.skyframe.InvalidatingNodeVisitor.DirtyingNodeVisitor; import com.google.devtools.build.skyframe.InvalidatingNodeVisitor.InvalidationState; 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 a8038c6844..2b4fa85c71 100644 --- a/src/main/java/com/google/devtools/build/skyframe/InvalidatingNodeVisitor.java +++ b/src/main/java/com/google/devtools/build/skyframe/InvalidatingNodeVisitor.java @@ -21,6 +21,7 @@ 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.ThreadSafety.ThreadSafe; import com.google.devtools.build.lib.util.Pair; |