From cd1e2519140211253120d49c8457e34833c6a3e9 Mon Sep 17 00:00:00 2001 From: Ivan Topolnjak Date: Wed, 13 Aug 2014 00:13:21 -0400 Subject: = core: ensure that MinMaxCounters never record values bellow zero, fixes #71 --- kamon-core/src/main/java/kamon/jsr166/LongMaxUpdater.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'kamon-core/src/main/java/kamon') diff --git a/kamon-core/src/main/java/kamon/jsr166/LongMaxUpdater.java b/kamon-core/src/main/java/kamon/jsr166/LongMaxUpdater.java index e4ba8807..fc9ea4e5 100644 --- a/kamon-core/src/main/java/kamon/jsr166/LongMaxUpdater.java +++ b/kamon-core/src/main/java/kamon/jsr166/LongMaxUpdater.java @@ -114,17 +114,17 @@ public class LongMaxUpdater extends Striped64 implements Serializable { * * @return the maximum */ - public long maxThenReset() { + public long maxThenReset(long newValue) { Cell[] as = cells; long max = base; - base = Long.MIN_VALUE; + base = newValue; if (as != null) { int n = as.length; for (int i = 0; i < n; ++i) { Cell a = as[i]; if (a != null) { long v = a.value; - a.value = Long.MIN_VALUE; + a.value = newValue; if (v > max) max = v; } -- cgit v1.2.3