# HG changeset patch # User Yasumasa Suenaga # Date 1595130948 -32400 # Node ID d617468f1ae86e98c81613479289cc3c4c2347af # Parent 76acc880d2a88db9197a15829d7c6faf872f4a89 Bug 3791: HeapStats agent should show warning if it run on JDK 8u262 or later Co-authored-by: KUBOTA Yuji Reviewed-by: ykubota https://github.com/HeapStats/heapstats/pull/154 diff -r 76acc880d2a8 -r d617468f1ae8 ChangeLog --- 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 + + * Bug 3791: HeapStats agent should show warning if it run on JDK 8u262 or later + 2019-11-19 Yasumasa Suenaga * Bump to 2.1.1 diff -r 76acc880d2a8 -r d617468f1ae8 agent/src/heapstats-engines/jvmInfo.cpp --- 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); + } + } }