Skip to content

Commit

Permalink
Reworked to share single instance of ByteBuddy
Browse files Browse the repository at this point in the history
  • Loading branch information
mjok committed Jan 24, 2020
1 parent d104029 commit 9daf7e5
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ public abstract class BaseTransformers implements RemoraAdvice {
public static boolean sendStackTrace;

public static ThreadLocal<CallStack<EntryDefinition>> stackThreadLocal = new ThreadLocal<>();
private static AgentBuilder agentBuilder = new AgentBuilder.Default(
new ByteBuddy().with(TypeValidation.DISABLED).with(MethodGraph.Compiler.ForDeclaredMethods.INSTANCE));

public static class EnhancedElementMatcher<T extends TypeDescription>
extends ElementMatcher.Junction.AbstractBase<T> {
Expand All @@ -63,10 +65,7 @@ public boolean matches(T target) {
}

public AgentBuilder.Identified.Extendable getTransform() {
ByteBuddy byteBuddy = new ByteBuddy().with(TypeValidation.DISABLED)
.with(MethodGraph.Compiler.ForDeclaredMethods.INSTANCE);

return new AgentBuilder.Default(byteBuddy)//
return agentBuilder//
// .with(listener) //
.disableClassFormatChanges()//
// .enableUnsafeBootstrapInjection() //
Expand Down

0 comments on commit 9daf7e5

Please # to comment.