Skip to content

Commit ce3bf6c

Browse files
committed
Adjust JFR checks for J9
1 parent 5b9a331 commit ce3bf6c

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

dd-java-agent/agent-profiling/src/main/java/com/datadog/profiling/agent/CompositeController.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,8 @@ public static Controller build(ConfigProvider provider, ControllerContext contex
153153
}
154154
if (!isOracleJDK8) {
155155
try {
156-
Class.forName("jdk.jfr.Event");
156+
Class<?> clz = Class.forName("jdk.jfr.Recording");
157+
clz.newInstance();
157158
controllers.add(OpenJdkController.instance(provider));
158159
} catch (Throwable ignored) {
159160
log.debug("Failed to load openjdk profiler", ignored);

dd-java-agent/testing/src/test/groovy/AgentTestRunnerTest.groovy

+2-1
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,8 @@ class AgentTestRunnerTest extends AgentTestRunner {
181181

182182
boolean isJFRSupported() {
183183
try {
184-
Class.forName("jdk.jfr.Recording")
184+
Class<?> clz = Class.forName("jdk.jfr.Recording")
185+
clz.newInstance()
185186
return true
186187
} catch (Throwable e) {
187188
return false

0 commit comments

Comments
 (0)