Difference between redefineClasses and retransformClasses?
Bastian Helfert
bastian.helfert at gmail.com
Mon May 19 09:43:16 PDT 2008
Hello everybody,
I re-read the API documentation for
*java.lang.instrument.Instrumentation*over and over again, but I could
not figure out what the (main) difference
is between the methods *redefineClasses* and *retransformClasses*.
Imagine I have multiple agents that (re)transform the bytecode of the same
class. By using *retransformClasses* the current definition of the class is
passed to the transform method.
But could not I also read the current class file bytes and instrument them,
e.g. by using a bytecode manipulation library, *before *I pass these bytes
to *redefineClasses*?
Hence, what can I do with *retransformClasses* that I cannot also do with *
redefineClasses*? Or is *retransformClasses* actually "API sugar"? When
would I use what method?
Thank you very much in advance,
Bastian Helfert
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/serviceability-dev/attachments/20080519/6a70f78f/attachment.html
More information about the serviceability-dev
mailing list