Merge pull request #503 from DataDog/tyler/weak-map-init

Initialize WeakMapProvider even earlier
This commit is contained in:
Tyler Benson 2018-09-19 10:24:42 +10:00 committed by GitHub
commit 7eaf069e45
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -20,6 +20,11 @@ import net.bytebuddy.utility.JavaModule;
@Slf4j
public class AgentInstaller {
static {
// WeakMap is used by other classes below, so we need to register the provider first.
registerWeakMapProvider();
}
public static final DDLocationStrategy LOCATION_STRATEGY = new DDLocationStrategy();
public static final AgentBuilder.PoolStrategy POOL_STRATEGY = new DDCachingPoolStrategy();
private static volatile Instrumentation INSTRUMENTATION;
@ -41,7 +46,6 @@ public class AgentInstaller {
public static ResettableClassFileTransformer installBytebuddyAgent(
final Instrumentation inst, final AgentBuilder.Listener... listeners) {
INSTRUMENTATION = inst;
registerWeakMapProvider();
AgentBuilder agentBuilder =
new AgentBuilder.Default()