I have finally got another idea to do this thing. So it’ time to end this topic.
For People who want to enhance the ThreadPoolExecuter or other classes used in the skywalking java agent without changing the code, the following project is for you! https://github.com/libinglong/skywalking-threadpool-agent It’s also an agent. By the way, I test the disableClassFormatChanges(), but it does not work well in some scene. If we want to find more error message, there is another type of listener net.bytebuddy.agent.builder.AgentBuilder.RedefinitionStrategy.Listener. For example: agentBuilder.type(pluginFinder.buildMatch()) .transform(new Transformer(pluginFinder)) .with(AgentBuilder.RedefinitionStrategy.RETRANSFORMATION) // this listener is different from the next listener .with(new RedefineListener()) .with(new Listener())
