diff options
author | Ivan Topolnjak <ivantopo@gmail.com> | 2014-08-13 00:13:21 -0400 |
---|---|---|
committer | Ivan Topolnjak <ivantopo@gmail.com> | 2014-08-13 00:13:21 -0400 |
commit | cd1e2519140211253120d49c8457e34833c6a3e9 (patch) | |
tree | 57d8ea51e5f1c48d0bd5a95a458b76d0ce099fb7 /kamon-core/src/main/java/kamon/jsr166 | |
parent | 274c4203931addf82306f7595dbe504daf3a9c94 (diff) | |
download | Kamon-cd1e2519140211253120d49c8457e34833c6a3e9.tar.gz Kamon-cd1e2519140211253120d49c8457e34833c6a3e9.tar.bz2 Kamon-cd1e2519140211253120d49c8457e34833c6a3e9.zip |
= core: ensure that MinMaxCounters never record values bellow zero, fixes #71
Diffstat (limited to 'kamon-core/src/main/java/kamon/jsr166')
-rw-r--r-- | kamon-core/src/main/java/kamon/jsr166/LongMaxUpdater.java | 6 |
1 files changed, 3 insertions, 3 deletions
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; } |