Skip to content

Commit e5ac639

Browse files
committed
Move load of Handlers into registerSmapEntryEvent()
1 parent 5510b08 commit e5ac639

File tree

1 file changed

+9
-8
lines changed
  • dd-java-agent/agent-bootstrap/src/main/java/datadog/trace/bootstrap

1 file changed

+9
-8
lines changed

dd-java-agent/agent-bootstrap/src/main/java/datadog/trace/bootstrap/Agent.java

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -866,14 +866,6 @@ private static synchronized void startJmx() {
866866
if (jmxStarting.getAndSet(true)) {
867867
return; // another thread is already in startJmx
868868
}
869-
// Load JFR Handlers class early, if present (it has been moved and renamed in JDK23+).
870-
// This prevents a deadlock. See PROF-13025.
871-
try {
872-
AGENT_CLASSLOADER.loadClass("jdk.jfr.events.Handlers");
873-
} catch (Exception e) {
874-
// Ignore when the class is not found or anything else goes wrong.
875-
}
876-
877869
if (jmxFetchEnabled) {
878870
startJmxFetch();
879871
}
@@ -932,6 +924,15 @@ private static synchronized void registerDeadlockDetectionEvent() {
932924

933925
private static synchronized void registerSmapEntryEvent() {
934926
log.debug("Initializing smap entry scraping");
927+
928+
// Load JFR Handlers class early, if present (it has been moved and renamed in JDK23+).
929+
// This prevents a deadlock. See PROF-13025.
930+
try {
931+
AGENT_CLASSLOADER.loadClass("jdk.jfr.events.Handlers");
932+
} catch (Exception e) {
933+
// Ignore when the class is not found or anything else goes wrong.
934+
}
935+
935936
try {
936937
final Class<?> smapFactoryClass =
937938
AGENT_CLASSLOADER.loadClass(

0 commit comments

Comments
 (0)