Author: todd Date: Tue Sep 25 23:16:20 2012 New Revision: 1390211 URL: http://svn.apache.org/viewvc?rev=1390211&view=rev Log: HADOOP-3957. Change MutableQuantiles to use a shared thread for rolling over metrics. Contributed by Andrew Wang.
Modified: hadoop/common/branches/branch-2/hadoop-common-project/hadoop-common/CHANGES.txt hadoop/common/branches/branch-2/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/lib/MutableQuantiles.java Modified: hadoop/common/branches/branch-2/hadoop-common-project/hadoop-common/CHANGES.txt URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-common-project/hadoop-common/CHANGES.txt?rev=1390211&r1=1390210&r2=1390211&view=diff ============================================================================== --- hadoop/common/branches/branch-2/hadoop-common-project/hadoop-common/CHANGES.txt (original) +++ hadoop/common/branches/branch-2/hadoop-common-project/hadoop-common/CHANGES.txt Tue Sep 25 23:16:20 2012 @@ -22,6 +22,9 @@ Release 2.0.3-alpha - Unreleased HADOOP-8812. ExitUtil#terminate should print Exception#toString. (eli) + HADOOP-3957. Change MutableQuantiles to use a shared thread for rolling + over metrics. (Andrew Wang via todd) + OPTIMIZATIONS BUG FIXES Modified: hadoop/common/branches/branch-2/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/lib/MutableQuantiles.java URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/lib/MutableQuantiles.java?rev=1390211&r1=1390210&r2=1390211&view=diff ============================================================================== --- hadoop/common/branches/branch-2/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/lib/MutableQuantiles.java (original) +++ hadoop/common/branches/branch-2/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/lib/MutableQuantiles.java Tue Sep 25 23:16:20 2012 @@ -35,6 +35,7 @@ import org.apache.hadoop.metrics2.util.Q 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 Mu @VisibleForTesting protected Map<Quantile, Long> 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