Enhancements in java.lang.instrument (original) (raw)
for the java.lang.instrument Package
The following functionality has been added to thejava.lang.instrument
package between its initial release in JDK 5.0 and Java™ SE 6.
- Support for retransformation of class files - To facilitate dynamic transformation of classes that have already been loaded, the following methods have been added.
- Instrumentation.retransformClasses(Class...)
- Instrumentation.addTransformer(ClassFileTransformer, boolean)
- Instrumentation.isModifiableClass(Class)
- Instrumentation.isRetransformClassesSupported()
They are suited to operations such as adding instrumentation to methods whose classes have already been loaded. Support for retransformation means that access to the original class file is no longer required in order to instrument loaded classes. They enable the easy removal of applied transformations and are designed to work in multi-agent environments.
- Support for instrumenting native methods - The following methods allow native methods to be instrumented by providing a JVM-aware mechanism for wrapping the native method.
- Support for appending to class loader search - The following methods allow instrumentation support classes to be defined in the appropriate class loader.
- Instrumentation.appendToBootstrapClassLoaderSearch(JarFile)
- Instrumentation.appendToSystemClassLoaderSearch(JarFile)