Initialize WeakMapProvider even earlier

It is used by classes delcared as static fields in AgentInstaller, so there were some cases where the fallback is being used.
This commit is contained in:
Tyler Benson 2018-09-18 16:59:38 +10:00
parent 70e4525131
commit f9f0438e85
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()