开发者

How mature is java.lang.instrument?

开发者 https://www.devze.com 2022-12-28 16:33 出处:网络
I\'ll be working on a project for instrumenting a relatively complex java applica开发者_运维百科tion, and I\'m planning to use java.lang.instrument to hook into the JVM and redefine classes before the

I'll be working on a project for instrumenting a relatively complex java applica开发者_运维百科tion, and I'm planning to use java.lang.instrument to hook into the JVM and redefine classes before they're loaded.

What is your take on this package? Is it well supported across JVMs? Does it work well with Hotspot?

Thanks!


java.lang.instrument is used by many very popular frameworks and pieces of software, including:

  • AspectJ
  • JRebel
  • JProfiler
  • The java profiling extensions themselves

which leds me to the conclusion that it is save to use. (Maybe not in your in case but that wasn't the question).

I use all the given frameworks while using the HotSpot compiler, and got no problems.


If you want to profile the java application, I would suggest using existing java profilers as this API is definitely still pretty new and has some issues.

Though the following article was written in 2005, the findings pretty much are still relevant

http://www.javalobby.org/java/forums/t19309.html

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号