|
|
@@ -11,8 +11,6 @@ package org.elasticsearch.server.cli;
|
|
|
|
|
|
import org.elasticsearch.common.settings.Settings;
|
|
|
import org.elasticsearch.common.util.concurrent.EsExecutors;
|
|
|
-import org.elasticsearch.core.Booleans;
|
|
|
-import org.elasticsearch.core.UpdateForV9;
|
|
|
import org.elasticsearch.jdk.RuntimeVersionFeature;
|
|
|
|
|
|
import java.io.IOException;
|
|
|
@@ -27,10 +25,10 @@ final class SystemJvmOptions {
|
|
|
|
|
|
static List<String> systemJvmOptions(Settings nodeSettings, final Map<String, String> sysprops) {
|
|
|
String distroType = sysprops.get("es.distribution.type");
|
|
|
+ String javaType = sysprops.get("es.java.type");
|
|
|
boolean isHotspot = sysprops.getOrDefault("sun.management.compiler", "").contains("HotSpot");
|
|
|
- boolean entitlementsExplicitlyEnabled = Booleans.parseBoolean(sysprops.getOrDefault("es.entitlements.enabled", "true"));
|
|
|
- // java 24+ only supports entitlements, but it may be enabled on earlier versions explicitly
|
|
|
- boolean useEntitlements = RuntimeVersionFeature.isSecurityManagerAvailable() == false || entitlementsExplicitlyEnabled;
|
|
|
+
|
|
|
+ boolean useEntitlements = true;
|
|
|
return Stream.of(
|
|
|
Stream.of(
|
|
|
/*
|
|
|
@@ -69,20 +67,20 @@ final class SystemJvmOptions {
|
|
|
"-Djava.locale.providers=" + getLocaleProviders(),
|
|
|
// Enable vectorization for whatever version we are running. This ensures we use vectorization even when running EA builds.
|
|
|
"-Dorg.apache.lucene.vectorization.upperJavaFeatureVersion=" + Runtime.version().feature(),
|
|
|
- // Pass through distribution type
|
|
|
- "-Des.distribution.type=" + distroType
|
|
|
+ // Pass through distribution type and java type
|
|
|
+ "-Des.distribution.type=" + distroType,
|
|
|
+ "-Des.java.type=" + javaType
|
|
|
),
|
|
|
maybeEnableNativeAccess(useEntitlements),
|
|
|
maybeOverrideDockerCgroup(distroType),
|
|
|
maybeSetActiveProcessorCount(nodeSettings),
|
|
|
maybeSetReplayFile(distroType, isHotspot),
|
|
|
maybeWorkaroundG1Bug(),
|
|
|
- maybeAllowSecurityManager(),
|
|
|
+ maybeAllowSecurityManager(useEntitlements),
|
|
|
maybeAttachEntitlementAgent(useEntitlements)
|
|
|
).flatMap(s -> s).toList();
|
|
|
}
|
|
|
|
|
|
- @UpdateForV9 // only use CLDR in v9+
|
|
|
private static String getLocaleProviders() {
|
|
|
/*
|
|
|
* When on pre-23, use COMPAT instead to maintain existing date formats as much as we can,
|
|
|
@@ -162,9 +160,8 @@ final class SystemJvmOptions {
|
|
|
return Stream.of();
|
|
|
}
|
|
|
|
|
|
- private static Stream<String> maybeAllowSecurityManager() {
|
|
|
- if (RuntimeVersionFeature.isSecurityManagerAvailable()) {
|
|
|
- // Will become conditional on useEntitlements once entitlements can run without SM
|
|
|
+ private static Stream<String> maybeAllowSecurityManager(boolean useEntitlements) {
|
|
|
+ if (RuntimeVersionFeature.isSecurityManagerAvailable() && useEntitlements == false) {
|
|
|
return Stream.of("-Djava.security.manager=allow");
|
|
|
}
|
|
|
return Stream.of();
|