From a0c542f7d8ecbafe71f4be79fb66e434653cd337 Mon Sep 17 00:00:00 2001 From: zdu Date: Thu, 6 Jul 2023 17:11:44 +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 | 7 +++++++ 1 file changed, 7 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..7ce554897 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,12 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; +import java.util.PriorityQueue; +import java.util.concurrent.ForkJoinPool; +import java.util.concurrent.ForkJoinTask; +import java.util.concurrent.PriorityBlockingQueue; +import java.util.concurrent.ScheduledThreadPoolExecutor; +import java.util.concurrent.ThreadPoolExecutor; /** * TTL Java Agent. @@ -218,6 +224,7 @@ 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, ForkJoinPool.class, ForkJoinTask.class, ScheduledThreadPoolExecutor.class, PriorityBlockingQueue.class, PriorityQueue.class); logger.info("[TtlAgent.premain] add Transformer " + transformer.getClass().getName() + " success"); logger.info("[TtlAgent.premain] end");