Skip to content

Commit 7eaf069

Browse files
authored
Merge pull request #503 from DataDog/tyler/weak-map-init
Initialize WeakMapProvider even earlier
2 parents 70e4525 + f9f0438 commit 7eaf069

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

dd-java-agent/agent-tooling/src/main/java/datadog/trace/agent/tooling/AgentInstaller.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@
2020

2121
@Slf4j
2222
public class AgentInstaller {
23+
static {
24+
// WeakMap is used by other classes below, so we need to register the provider first.
25+
registerWeakMapProvider();
26+
}
27+
2328
public static final DDLocationStrategy LOCATION_STRATEGY = new DDLocationStrategy();
2429
public static final AgentBuilder.PoolStrategy POOL_STRATEGY = new DDCachingPoolStrategy();
2530
private static volatile Instrumentation INSTRUMENTATION;
@@ -41,7 +46,6 @@ public static ResettableClassFileTransformer installBytebuddyAgent(final Instrum
4146
public static ResettableClassFileTransformer installBytebuddyAgent(
4247
final Instrumentation inst, final AgentBuilder.Listener... listeners) {
4348
INSTRUMENTATION = inst;
44-
registerWeakMapProvider();
4549

4650
AgentBuilder agentBuilder =
4751
new AgentBuilder.Default()

0 commit comments

Comments
 (0)