Ostap Maliuvanchuk
Ostap Maliuvanchuk

Reputation: 1175

Instrument Java Thread

I am trying to instrument java.lang.Thread class with ASM. But it's not being loaded into ASM.

I start my program with:

java -javaagent:agent.jar -jar program.jar

Other classes from program.jar are loaded and instrumented. Is it possible to instrument Thread as well?

Upvotes: 0

Views: 441

Answers (1)

Darth Android
Darth Android

Reputation: 3502

Probably not. Even if you retransform the java.lang.Thread class, retransformations cannot be applied if a class has frames on a threadstack, and by definition, I would expect some of Thread's frames to be at the top of every threadstack (including the one running your java agent!).

Upvotes: 2

Related Questions