summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 36c657e)
raw | patch | inline | side by side (parent: 36c657e)
author | Pierre Mauduit <pierre.mauduit@camptocamp.com> | |
Mon, 30 Jan 2017 16:56:35 +0000 (17:56 +0100) | ||
committer | Pierre Mauduit <pierre.mauduit@camptocamp.com> | |
Mon, 30 Jan 2017 17:05:03 +0000 (18:05 +0100) |
AtomicIntegers are used to address some concurrency problems in Java, and this
is advised by some metrics libraries like Netflix's servo:
https://github.com/Netflix/servo/wiki#jmx
Unfortunately, the GenericJMXConfValue.java class is not able to get the values
from such types, hence this PR.
I scanned the Java doc for the Java package:
https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/atomic/package-summary.html
I think I have not forgotten any types.
Tests: tested at runtime
is advised by some metrics libraries like Netflix's servo:
https://github.com/Netflix/servo/wiki#jmx
Unfortunately, the GenericJMXConfValue.java class is not able to get the values
from such types, hence this PR.
I scanned the Java doc for the Java package:
https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/atomic/package-summary.html
I think I have not forgotten any types.
Tests: tested at runtime
bindings/java/org/collectd/java/GenericJMXConfValue.java | patch | blob | history |
diff --git a/bindings/java/org/collectd/java/GenericJMXConfValue.java b/bindings/java/org/collectd/java/GenericJMXConfValue.java
index 63b76282ecfa7ddbb38bfec94440876c33275230..6d3d688eaab991353bd780b6b95508f824ca4313 100644 (file)
import java.util.List;
import java.util.Collection;
import java.util.Set;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.concurrent.atomic.AtomicLong;
import java.util.Iterator;
import java.util.ArrayList;
{
return (BigInteger.ZERO.add ((BigInteger) obj));
}
+ else if (obj instanceof AtomicInteger)
+ {
+ return (new Integer(((AtomicInteger) obj).get()));
+ }
+ else if (obj instanceof AtomicLong)
+ {
+ return (new Long(((AtomicLong) obj).get()));
+ }
return (null);
} /* }}} Number genericObjectToNumber */