diff --git a/joylive-implement/joylive-bytekit/joylive-bytekit-bytebuddy/src/main/java/com/jd/live/agent/implement/bytekit/bytebuddy/handler/PoolHandler.java b/joylive-implement/joylive-bytekit/joylive-bytekit-bytebuddy/src/main/java/com/jd/live/agent/implement/bytekit/bytebuddy/handler/PoolHandler.java index cbab78fa..37cc83ca 100644 --- a/joylive-implement/joylive-bytekit/joylive-bytekit-bytebuddy/src/main/java/com/jd/live/agent/implement/bytekit/bytebuddy/handler/PoolHandler.java +++ b/joylive-implement/joylive-bytekit/joylive-bytekit-bytebuddy/src/main/java/com/jd/live/agent/implement/bytekit/bytebuddy/handler/PoolHandler.java @@ -30,6 +30,7 @@ import net.bytebuddy.agent.builder.AgentBuilder.PoolStrategy; import java.lang.instrument.Instrumentation; +import java.util.concurrent.ThreadLocalRandom; /** * PoolHandler @@ -68,7 +69,9 @@ private void addCleanTask() { int old = poolCache.size(); poolCache.recycle(enhanceConfig.getPoolExpireTime()); int current = poolCache.size(); - logger.info("Clean expired cache from byte buddy pool. " + old + " -> " + current); + if (old != current || ThreadLocalRandom.current().nextInt(10) == 0) { + logger.info("Clean expired cache from byte buddy pool. " + old + " -> " + current); + } addCleanTask(); }); }