diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt index d4d4639953c..0b28f4cb649 100644 --- a/hadoop-common-project/hadoop-common/CHANGES.txt +++ b/hadoop-common-project/hadoop-common/CHANGES.txt @@ -244,6 +244,9 @@ Trunk (Unreleased) required context item is not configured (Brahma Reddy Battula via harsh) + HADOOP-3957. Change MutableQuantiles to use a shared thread for rolling + over metrics. (Andrew Wang via todd) + OPTIMIZATIONS HADOOP-7761. Improve the performance of raw comparisons. (todd) diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/lib/MutableQuantiles.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/lib/MutableQuantiles.java index e8992983a53..af579851782 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/lib/MutableQuantiles.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/lib/MutableQuantiles.java @@ -35,6 +35,7 @@ import org.apache.hadoop.metrics2.util.Quantile; import org.apache.hadoop.metrics2.util.SampleQuantiles; import com.google.common.annotations.VisibleForTesting; +import com.google.common.util.concurrent.ThreadFactoryBuilder; /** * Watches a stream of long values, maintaining online estimates of specific @@ -60,8 +61,9 @@ public class MutableQuantiles extends MutableMetric { @VisibleForTesting protected Map previousSnapshot = null; - private final ScheduledExecutorService scheduler = Executors - .newScheduledThreadPool(1); + private static final ScheduledExecutorService scheduler = Executors + .newScheduledThreadPool(1, new ThreadFactoryBuilder().setDaemon(true) + .setNameFormat("MutableQuantiles-%d").build()); /** * Instantiates a new {@link MutableQuantiles} for a metric that rolls itself