Juan Tamayo
Juan Tamayo

Reputation: 155

How mature is java.lang.instrument?

I'll be working on a project for instrumenting a relatively complex java application, 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!

Upvotes: 3

Views: 1313

Answers (2)

Daniel
Daniel

Reputation: 28094

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.

Upvotes: 1

Fazal
Fazal

Reputation: 3051

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

Upvotes: 0

Related Questions