无法通过字节预算来检测threadPoolExecutor

时间:2019-03-06 21:51:00

标签: byte-buddy

我在这篇文章中遇到了同样的问题。

https://stackoverflow.com/questions/49321938/instrument-in-java-level-using-byte-buddy/55032131#55032131

当我使用代码工具threadpoolexecutor时,

new AgentBuilder.Default()
            .ignore(ElementMatchers.none())
            .type(ElementMatchers.nameContains("ThreadPoolExecutor"))
            .transform((builder, type, classLoader, module) -> builder
                    .visit(Advice.to(ThreadPoolExecutorAdvice.class).on(ElementMatchers.any()))
            ).installOn(instrumentation);

我收到此错误,如何解决?

 java.lang.IllegalStateException: Cannot represent public org.apache.tomcat.util.threads.ThreadPoolExecutor(int,int,long,java.util.concurrent.TimeUnit,java.util.concurrent.BlockingQueue,java.util.concurrent.RejectedExecutionHandler) as given method constant

1 个答案:

答案 0 :(得分:0)

您可能正在尝试插入Method时注入Constructor实例。切换参数类型,它应该可以解决。