aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/buildtool/ExecutionProgressReceiver.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/buildtool/ExecutionProgressReceiver.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/buildtool/ExecutionProgressReceiver.java19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/buildtool/ExecutionProgressReceiver.java b/src/main/java/com/google/devtools/build/lib/buildtool/ExecutionProgressReceiver.java
index 2b614b0630..484298c4c7 100644
--- a/src/main/java/com/google/devtools/build/lib/buildtool/ExecutionProgressReceiver.java
+++ b/src/main/java/com/google/devtools/build/lib/buildtool/ExecutionProgressReceiver.java
@@ -46,7 +46,13 @@ public final class ExecutionProgressReceiver
extends EvaluationProgressReceiver.NullEvaluationProgressReceiver
implements SkyframeActionExecutor.ProgressSupplier,
SkyframeActionExecutor.ActionCompletedReceiver {
- private static final NumberFormat PROGRESS_MESSAGE_NUMBER_FORMATTER;
+ private static final ThreadLocal<NumberFormat> PROGRESS_MESSAGE_NUMBER_FORMATTER =
+ ThreadLocal.withInitial(
+ () -> {
+ NumberFormat numberFormat = NumberFormat.getIntegerInstance(Locale.ENGLISH);
+ numberFormat.setGroupingUsed(true);
+ return numberFormat;
+ });
// Must be thread-safe!
private final Set<ConfiguredTargetKey> builtTargets;
@@ -59,11 +65,6 @@ public final class ExecutionProgressReceiver
/** Number of exclusive tests. To be accounted for in progress messages. */
private final int exclusiveTestsCount;
- static {
- PROGRESS_MESSAGE_NUMBER_FORMATTER = NumberFormat.getIntegerInstance(Locale.ENGLISH);
- PROGRESS_MESSAGE_NUMBER_FORMATTER.setGroupingUsed(true);
- }
-
/**
* {@code builtTargets} is accessed through a synchronized set, and so no other access to it is
* permitted while this receiver is active.
@@ -153,8 +154,10 @@ public final class ExecutionProgressReceiver
public String getProgressString() {
return String.format(
"[%s / %s]",
- PROGRESS_MESSAGE_NUMBER_FORMATTER.format(completedActions.size()),
- PROGRESS_MESSAGE_NUMBER_FORMATTER.format(exclusiveTestsCount + enqueuedActions.size()));
+ PROGRESS_MESSAGE_NUMBER_FORMATTER.get().format(completedActions.size()),
+ PROGRESS_MESSAGE_NUMBER_FORMATTER
+ .get()
+ .format(exclusiveTestsCount + enqueuedActions.size()));
}
ActionExecutionInactivityWatchdog.InactivityMonitor createInactivityMonitor(