From 4709f62cd0e58d6b9ed6eac575e66ca23ea88c62 Mon Sep 17 00:00:00 2001 From: Stuart McCulloch Date: Sun, 22 Dec 2024 15:32:52 +0000 Subject: [PATCH] Move SharedCommunicationObjects creation to InstallDatadogTracerCallback constructor --- .../java/datadog/trace/bootstrap/Agent.java | 21 +++++++++---------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/dd-java-agent/agent-bootstrap/src/main/java/datadog/trace/bootstrap/Agent.java b/dd-java-agent/agent-bootstrap/src/main/java/datadog/trace/bootstrap/Agent.java index dfeb737dc55..61dce68b3b2 100644 --- a/dd-java-agent/agent-bootstrap/src/main/java/datadog/trace/bootstrap/Agent.java +++ b/dd-java-agent/agent-bootstrap/src/main/java/datadog/trace/bootstrap/Agent.java @@ -498,22 +498,13 @@ public void execute() { protected static class InstallDatadogTracerCallback extends ClassLoadCallBack { private final InitializationTelemetry initTelemetry; private final Instrumentation instrumentation; + private final Object sco; + private final Class scoClass; public InstallDatadogTracerCallback( InitializationTelemetry initTelemetry, Instrumentation instrumentation) { this.initTelemetry = initTelemetry; this.instrumentation = instrumentation; - } - - @Override - public AgentThread agentThread() { - return TRACE_STARTUP; - } - - @Override - public void execute() { - Object sco; - Class scoClass; try { scoClass = AGENT_CLASSLOADER.loadClass("datadog.communication.ddagent.SharedCommunicationObjects"); @@ -525,7 +516,15 @@ public void execute() { | InvocationTargetException e) { throw new UndeclaredThrowableException(e); } + } + + @Override + public AgentThread agentThread() { + return TRACE_STARTUP; + } + @Override + public void execute() { installDatadogTracer(initTelemetry, scoClass, sco); maybeStartAppSec(scoClass, sco); maybeStartIast(instrumentation, scoClass, sco);