You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by kl...@apache.org on 2019/01/08 21:30:57 UTC
[geode] branch develop updated: GEODE-6253: Handle JDK-8207200
gracefully in VM stats
This is an automated email from the ASF dual-hosted git repository.
klund pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/geode.git
The following commit(s) were added to refs/heads/develop by this push:
new 1143af9 GEODE-6253: Handle JDK-8207200 gracefully in VM stats
1143af9 is described below
commit 1143af997292df0f6d480084ffd2103fa2c17bbf
Author: Kirk Lund <kl...@apache.org>
AuthorDate: Mon Jan 7 16:43:34 2019 -0800
GEODE-6253: Handle JDK-8207200 gracefully in VM stats
---
.../apache/geode/internal/stats50/VMStats50.java | 39 ++++++++++++++++++++--
1 file changed, 37 insertions(+), 2 deletions(-)
diff --git a/geode-core/src/main/java/org/apache/geode/internal/stats50/VMStats50.java b/geode-core/src/main/java/org/apache/geode/internal/stats50/VMStats50.java
index 79e6879..6180233 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/stats50/VMStats50.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/stats50/VMStats50.java
@@ -621,14 +621,49 @@ public class VMStats50 implements VMStatsContract {
}
}
- refresh(this.heapMemStats, memBean.getHeapMemoryUsage());
- refresh(this.nonHeapMemStats, memBean.getNonHeapMemoryUsage());
+ refresh(this.heapMemStats, getHeapMemoryUsage(memBean));
+ refresh(this.nonHeapMemStats, getNonHeapMemoryUsage(memBean));
refreshGC();
refreshMemoryPools();
refreshThreads();
}
+ /**
+ * Handle JDK-8207200 gracefully while fetching getHeapMemoryUsage from MemoryMXBean.
+ *
+ * @see <a href="https://bugs.openjdk.java.net/browse/JDK-8207200">JDK-8207200</a>
+ */
+ private MemoryUsage getHeapMemoryUsage(MemoryMXBean memBean) {
+ try {
+ return memBean.getHeapMemoryUsage();
+ } catch (IllegalArgumentException e) {
+ if (logger.isDebugEnabled()) {
+ logger.debug("JDK-8207200 prevented stat sampling for HeapMemoryUsage");
+ }
+ return null;
+ }
+ }
+
+ /**
+ * Handle JDK-8207200 gracefully while fetching getNonHeapMemoryUsage from MemoryMXBean.
+ *
+ * @see <a href="https://bugs.openjdk.java.net/browse/JDK-8207200">JDK-8207200</a>
+ */
+ private MemoryUsage getNonHeapMemoryUsage(MemoryMXBean memBean) {
+ try {
+ return memBean.getNonHeapMemoryUsage();
+ } catch (IllegalArgumentException e) {
+ if (logger.isDebugEnabled()) {
+ logger.debug("JDK-8207200 prevented stat sampling for NonHeapMemoryUsage");
+ }
+ return null;
+ }
+ }
+
private void refresh(Statistics stats, MemoryUsage mu) {
+ if (mu == null) {
+ return;
+ }
stats.setLong(mu_initMemoryId, mu.getInit());
stats.setLong(mu_usedMemoryId, mu.getUsed());
stats.setLong(mu_committedMemoryId, mu.getCommitted());