changeset 278:d617468f1ae8 default tip

Bug 3791: HeapStats agent should show warning if it run on JDK 8u262 or later Co-authored-by: KUBOTA Yuji <kubota.yuji@gmail.com> Reviewed-by: ykubota https://github.com/HeapStats/heapstats/pull/154
author Yasumasa Suenaga <yasuenag@gmail.com>
date Sun, 19 Jul 2020 12:55:48 +0900
parents 76acc880d2a8
children
files ChangeLog agent/src/heapstats-engines/jvmInfo.cpp
diffstat 2 files changed, 19 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Tue Nov 19 09:09:40 2019 +0900
+++ b/ChangeLog	Sun Jul 19 12:55:48 2020 +0900
@@ -1,3 +1,7 @@
+2020-07-19  Yasumasa Suenaga <yasuenag@gmail.com>
+
+	* Bug 3791: HeapStats agent should show warning if it run on JDK 8u262 or later
+
 2019-11-19  Yasumasa Suenaga <yasuenag@gmail.com>
 
 	* Bump to 2.1.1
--- a/agent/src/heapstats-engines/jvmInfo.cpp	Tue Nov 19 09:09:40 2019 +0900
+++ b/agent/src/heapstats-engines/jvmInfo.cpp	Sun Jul 19 12:55:48 2020 +0900
@@ -1,7 +1,7 @@
 /*!
  * \file jvmInfo.cpp
  * \brief This file is used to get JVM performance information.
- * Copyright (C) 2011-2016 Nippon Telegraph and Telephone Corporation
+ * Copyright (C) 2011-2020 Nippon Telegraph and Telephone Corporation
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -526,4 +526,18 @@
   if (!isAfterJDK9()) {
     loadDelayLogFlag &= (_endorsedPath != NULL) && (_bootClassPath != NULL);
   }
+
+  /* JFR-backported JDK 8 is not supported */
+#if USE_PCRE
+  TPCRERegex versionRegex("^\\d+\\.(\\d+)\\.\\d+_(\\d+)[^0-9]*$", 9);
+#else
+  TCPPRegex versionRegex("^\\d+\\.(\\d+)\\.\\d+_(\\d+)[^0-9]*$");
+#endif
+  if (versionRegex.find(this->_javaVersion)) {
+    int major = atoi(versionRegex.group(1));
+    int update = atoi(versionRegex.group(2));
+    if ((major == 8) && (update >= 262)) {
+      logger->printWarnMsg("JDK %s is not recommended due to JFR backport", this->_javaVersion);
+    }
+  }
 }