Skip to content

Commit 9adff2f

Browse files
committed
Comment explaining entitlement add-exports
1 parent c37aa47 commit 9adff2f

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

distribution/tools/server-cli/src/main/java/org/elasticsearch/server/cli/SystemJvmOptions.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,13 +167,16 @@ private static Stream<String> maybeAttachEntitlementAgent(boolean useEntitlement
167167
} catch (IOException e) {
168168
throw new IllegalStateException("Failed to list entitlement jars in: " + dir, e);
169169
}
170-
String modulesThatCallBridge = "java.logging";
170+
// We instrument classes in these modules to call the bridge. Because the bridge gets patched
171+
// into java.base, we must export the bridge from java.base to these modules.
172+
String modulesContainingEntitlementInstrumentation = "java.logging";
171173
return Stream.of(
172174
"-Des.entitlements.enabled=true",
173175
"-XX:+EnableDynamicAgentLoading",
174176
"-Djdk.attach.allowAttachSelf=true",
175177
"--patch-module=java.base=" + bridgeJar,
176-
"--add-exports=java.base/org.elasticsearch.entitlement.bridge=org.elasticsearch.entitlement," + modulesThatCallBridge
178+
"--add-exports=java.base/org.elasticsearch.entitlement.bridge=org.elasticsearch.entitlement,"
179+
+ modulesContainingEntitlementInstrumentation
177180
);
178181
}
179182
}

0 commit comments

Comments
 (0)