aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/concurrent
diff options
context:
space:
mode:
authorGravatar Nathan Harmata <nharmata@google.com>2016-11-23 22:06:51 +0000
committerGravatar Dmitry Lomov <dslomov@google.com>2016-11-24 10:32:59 +0000
commit64de4b555a93aa9779cbf54aa1202193a4ed76a5 (patch)
treefbb8a840c1c526423a582b5a4d6f14406550bc13 /src/main/java/com/google/devtools/build/lib/concurrent
parent270fdd6b4a22f96a3642e7d3bb562b721cde099b (diff)
If set, have BlazeInterners use the value of the BLAZE_INTERNER_CONCURRENCY_LEVEL environment variable.
-- MOS_MIGRATED_REVID=140070022
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/concurrent')
-rw-r--r--src/main/java/com/google/devtools/build/lib/concurrent/BlazeInterners.java9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/concurrent/BlazeInterners.java b/src/main/java/com/google/devtools/build/lib/concurrent/BlazeInterners.java
index d54793d8e1..b43b09bebd 100644
--- a/src/main/java/com/google/devtools/build/lib/concurrent/BlazeInterners.java
+++ b/src/main/java/com/google/devtools/build/lib/concurrent/BlazeInterners.java
@@ -19,7 +19,13 @@ import com.google.common.collect.Interners.InternerBuilder;
/** Wrapper around {@link Interners}, with Blaze-specific predetermined concurrency levels. */
public class BlazeInterners {
- private static final int CONCURRENCY_LEVEL = Runtime.getRuntime().availableProcessors();
+ private static final int DEFAULT_CONCURRENCY_LEVEL = Runtime.getRuntime().availableProcessors();
+ private static final int CONCURRENCY_LEVEL;
+
+ static {
+ String val = System.getenv("BLAZE_INTERNER_CONCURRENCY_LEVEL");
+ CONCURRENCY_LEVEL = (val == null) ? DEFAULT_CONCURRENCY_LEVEL : Integer.parseInt(val);
+ }
private static InternerBuilder setConcurrencyLevel(InternerBuilder builder) {
return builder.concurrencyLevel(CONCURRENCY_LEVEL);
@@ -33,3 +39,4 @@ public class BlazeInterners {
return setConcurrencyLevel(Interners.newBuilder().strong()).build();
}
}
+