From 95180e414386afc94e730005adea40867f07298d Mon Sep 17 00:00:00 2001 From: Darrel Schneider Date: Fri, 6 May 2022 09:17:55 -0700 Subject: [PATCH] GEODE-10206: clean up product references to CMS (#7646) * the command line validator no longer warns if CMS is not configured if the JDK does not support CMS * cleaned up comments that refer to CMS --- extensions/geode-modules/build.gradle | 1 + .../modules/session/bootstrap/AbstractCache.java | 5 ++--- .../geode/modules/util/ResourceManagerValidator.java | 12 +++++++++++- .../src/test/resources/expected-pom.xml | 5 +++++ .../org/apache/geode/cache/EvictionAttributes.java | 5 +++-- .../apache/geode/cache/control/ResourceManager.java | 5 +++-- 6 files changed, 25 insertions(+), 8 deletions(-) diff --git a/extensions/geode-modules/build.gradle b/extensions/geode-modules/build.gradle index 806dceddc9f0..d35dd544d425 100644 --- a/extensions/geode-modules/build.gradle +++ b/extensions/geode-modules/build.gradle @@ -37,6 +37,7 @@ dependencies { compileOnly('javax.servlet:javax.servlet-api') compileOnly('org.apache.tomcat:catalina-ha:' + DependencyConstraints.get('tomcat6.version')) + implementation('org.apache.commons:commons-lang3') // test testImplementation('org.apache.bcel:bcel') diff --git a/extensions/geode-modules/src/main/java/org/apache/geode/modules/session/bootstrap/AbstractCache.java b/extensions/geode-modules/src/main/java/org/apache/geode/modules/session/bootstrap/AbstractCache.java index d1b760042770..1d9df9d5389a 100644 --- a/extensions/geode-modules/src/main/java/org/apache/geode/modules/session/bootstrap/AbstractCache.java +++ b/extensions/geode-modules/src/main/java/org/apache/geode/modules/session/bootstrap/AbstractCache.java @@ -363,9 +363,8 @@ private void initializeResourceManager() { } } - // Validate java startup parameters (done after setting the eviction and - // critical heap percentages so that the CMSInitiatingOccupancyFraction can - // be compared against them. + // Validate java startup parameters after setting the eviction and + // critical heap percentages so that they can be compared against them. ResourceManagerValidator.validateJavaStartupParameters(getCache()); } diff --git a/extensions/geode-modules/src/main/java/org/apache/geode/modules/util/ResourceManagerValidator.java b/extensions/geode-modules/src/main/java/org/apache/geode/modules/util/ResourceManagerValidator.java index 5541fdce3dd4..c9b40118d030 100644 --- a/extensions/geode-modules/src/main/java/org/apache/geode/modules/util/ResourceManagerValidator.java +++ b/extensions/geode-modules/src/main/java/org/apache/geode/modules/util/ResourceManagerValidator.java @@ -14,6 +14,9 @@ */ package org.apache.geode.modules.util; +import static org.apache.commons.lang3.JavaVersion.JAVA_13; +import static org.apache.commons.lang3.SystemUtils.isJavaVersionAtMost; + import java.lang.management.ManagementFactory; import java.lang.management.RuntimeMXBean; import java.util.ArrayList; @@ -106,8 +109,12 @@ private static void validateJavaHeapParameters(GemFireCache cache, String dashXm } } + private static boolean isCMSAvailable() { + return isJavaVersionAtMost(JAVA_13); + } + private static void verifyCMSGC(GemFireCache cache, String useCMS) { - if (useCMS == null) { + if (useCMS == null && isCMSAvailable()) { cache.getLogger().warning( "Using the concurrent garbage collector (configured using -XX:+UseConcMarkSweepGC) is recommended so that GemFire cache eviction is optimal"); } @@ -115,6 +122,9 @@ private static void verifyCMSGC(GemFireCache cache, String useCMS) { private static void verifyCMSInitiatingOccupancyFraction(GemFireCache cache, ResourceManager rm, String cmsIOF) { + if (!isCMSAvailable()) { + return; + } if (cmsIOF == null) { cache.getLogger().warning( "Setting the CMS initiating occupancy fraction (configured using -XX:CMSInitiatingOccupancyFraction=N) is recommended so that GemFire cache eviction is optimal"); diff --git a/extensions/geode-modules/src/test/resources/expected-pom.xml b/extensions/geode-modules/src/test/resources/expected-pom.xml index c8b2c2e9a642..4cd26469146d 100644 --- a/extensions/geode-modules/src/test/resources/expected-pom.xml +++ b/extensions/geode-modules/src/test/resources/expected-pom.xml @@ -76,5 +76,10 @@ slf4j-api runtime + + org.apache.commons + commons-lang3 + runtime + diff --git a/geode-core/src/main/java/org/apache/geode/cache/EvictionAttributes.java b/geode-core/src/main/java/org/apache/geode/cache/EvictionAttributes.java index 1029c2ac42d6..b2e340584f66 100644 --- a/geode-core/src/main/java/org/apache/geode/cache/EvictionAttributes.java +++ b/geode-core/src/main/java/org/apache/geode/cache/EvictionAttributes.java @@ -155,8 +155,9 @@ public static EvictionAttributes createLRUEntryAttributes(int maximumEntries, * switches to control the behavior of the garbage collector. We suggest that you investigate * tuning the garbage collector when using this type of eviction controller. A collector that * frequently collects is needed to keep our heap usage up to date. In particular, on the Sun - * HotSpot JVM, the - * -XX:+UseConcMarkSweepGC flag needs to be set, and + * HotSpot JVM, + * before Java 14, + * the -XX:+UseConcMarkSweepGC flag needs to be set, and * -XX:CMSInitiatingOccupancyFraction=N should be set with N being a percentage that * is less than the {@link ResourceManager} eviction heap threshold. *

diff --git a/geode-core/src/main/java/org/apache/geode/cache/control/ResourceManager.java b/geode-core/src/main/java/org/apache/geode/cache/control/ResourceManager.java index 539259b3dffb..b231cf2e2563 100644 --- a/geode-core/src/main/java/org/apache/geode/cache/control/ResourceManager.java +++ b/geode-core/src/main/java/org/apache/geode/cache/control/ResourceManager.java @@ -127,8 +127,9 @@ public interface ResourceManager { * additional VM switches to control the behavior of the garbage collector. We suggest that you * investigate tuning the garbage collector when using this type of eviction controller. A * collector that frequently collects is needed to keep our heap usage up to date. In particular, - * on the Sun HotSpot VM, the - * -XX:+UseConcMarkSweepGC flag needs to be set, and + * on the Sun HotSpot VM, + * before Java 14, + * the -XX:+UseConcMarkSweepGC flag needs to be set, and * -XX:CMSInitiatingOccupancyFraction=N should be set with N being a percentage that * is less than the {@link ResourceManager} critical and eviction heap thresholds. *