diff --git a/hystrix-core/src/main/java/com/netflix/hystrix/metric/CachedValuesHistogram.java b/hystrix-core/src/main/java/com/netflix/hystrix/metric/CachedValuesHistogram.java index 8bff8623a..d4a703d82 100644 --- a/hystrix-core/src/main/java/com/netflix/hystrix/metric/CachedValuesHistogram.java +++ b/hystrix-core/src/main/java/com/netflix/hystrix/metric/CachedValuesHistogram.java @@ -17,18 +17,9 @@ import org.HdrHistogram.Histogram; -import java.util.concurrent.ConcurrentLinkedQueue; - public class CachedValuesHistogram { - static int POOL_SIZE = 1000; - static ConcurrentLinkedQueue HISTOGRAM_POOL = new ConcurrentLinkedQueue(); - - static { - for (int i = 0; i < POOL_SIZE; i++) { - HISTOGRAM_POOL.add(new Histogram(3)); - } - } + private final static int NUMBER_SIGNIFICANT_DIGITS = 3; private final int mean; private final int p0; @@ -100,8 +91,6 @@ private CachedValuesHistogram(Histogram underlying) { p100 = (int) underlying.getValueAtPercentile(100); totalCount = underlying.getTotalCount(); - - release(underlying); } /** @@ -155,16 +144,7 @@ public long getTotalCount() { return totalCount; } - private static void release(Histogram histogram) { - histogram.reset(); - HISTOGRAM_POOL.offer(histogram); - } - public static Histogram getNewHistogram() { - Histogram histogram = HISTOGRAM_POOL.poll(); - if (histogram == null) { - histogram = new Histogram(3); - } - return histogram; + return new Histogram(NUMBER_SIGNIFICANT_DIGITS); } }