From 0892946e7f031082e72c23fb4e16664a4630fd21 Mon Sep 17 00:00:00 2001 From: zdu Date: Thu, 6 Jul 2023 18:08:31 +0800 Subject: [PATCH] issue-525:Fix the issue where ttlagent does not work when adding other agent --- .../src/main/java/com/alibaba/ttl3/agent/TtlAgent.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ttl-agent/src/main/java/com/alibaba/ttl3/agent/TtlAgent.java b/ttl-agent/src/main/java/com/alibaba/ttl3/agent/TtlAgent.java index bfdac2a75..2dac55375 100644 --- a/ttl-agent/src/main/java/com/alibaba/ttl3/agent/TtlAgent.java +++ b/ttl-agent/src/main/java/com/alibaba/ttl3/agent/TtlAgent.java @@ -14,6 +14,10 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; +import java.util.PriorityQueue; +import java.util.concurrent.PriorityBlockingQueue; +import java.util.concurrent.ScheduledThreadPoolExecutor; +import java.util.concurrent.ThreadPoolExecutor; /** * TTL Java Agent. @@ -218,6 +222,8 @@ public static void premain(final String agentArgs, @NonNull final Instrumentatio final ClassFileTransformer transformer = new TtlTransformer(transformletList, isLogClassTransform()); inst.addTransformer(transformer, true); + + inst.retransformClasses(ThreadPoolExecutor.class, ScheduledThreadPoolExecutor.class, PriorityBlockingQueue.class, PriorityQueue.class); logger.info("[TtlAgent.premain] add Transformer " + transformer.getClass().getName() + " success"); logger.info("[TtlAgent.premain] end");