public class MonitoringClassFileTransformer extends AbstractClassTransformer implements java.lang.instrument.ClassFileTransformer
DELEGATING_RANDOM_ACCESS_FILE| Constructor and Description |
|---|
MonitoringClassFileTransformer()
Creates a new monitoring class file transformer.
|
| Modifier and Type | Method and Description |
|---|---|
private byte[] |
doClass(java.lang.ClassLoader loader,
java.lang.String name,
byte[] classBytes,
boolean isRedefinition)
Processes the given class.
|
private static java.lang.StackTraceElement |
getClosest(java.lang.StackTraceElement[] trace,
java.lang.String pkg)
Returns the first stack trace element in
trace which
relates to the given package pkg. |
private static void |
log(java.lang.String text,
java.lang.Throwable th,
java.util.logging.Level level)
Logs the message and attaches the first stack trace element (seen from
the top of the stack) which belongs to this package.
|
protected void |
retransformAssigned(java.lang.String[] classNames)
Retransforms the specified classes.
|
byte[] |
transform(java.lang.ClassLoader loader,
java.lang.String className,
java.lang.Class<?> classBeingRedefined,
java.security.ProtectionDomain protectionDomain,
byte[] classFileBuffer)
The implementation of this method may transform the supplied class file
and return a new replacement class file.
|
private byte[] |
transform0(java.lang.String name,
de.uni_hildesheim.sse.monitoring.runtime.instrumentation.lib.IClass cl,
TransformationType type)
Top-level call of
AbstractClassTransformer.transform(String, IClass, TransformationType). |
assignSemantics, deleteSemantics, getAnnotation, getAnnotation, getAnnotation, handleMethodInstrumentationException, internalVmFqnToJavaFqn, javaFqnToInternalVmFqnTo, pruneAnnotation, shouldInstrument, transformpublic MonitoringClassFileTransformer()
public byte[] transform(java.lang.ClassLoader loader,
java.lang.String className,
java.lang.Class<?> classBeingRedefined,
java.security.ProtectionDomain protectionDomain,
byte[] classFileBuffer)
throws java.lang.instrument.IllegalClassFormatException
transform in interface java.lang.instrument.ClassFileTransformerloader - - the defining loader of the class to be transformed,
may be null if the bootstrap loaderclassName - - the name of the class in the internal form of
fully qualified class and interface names as defined in The Java
Virtual Machine Specification. For example, "java/util/List".classBeingRedefined - - if this is triggered by a redefine or
retransform, the class being redefined or retransformed; if this
is a class load, nullprotectionDomain - - the protection domain of the class being
defined or redefinedclassFileBuffer - - the input byte buffer in class file format -
must not be modifiedjava.lang.instrument.IllegalClassFormatException - in case that illegal byte code is
producedprivate final byte[] doClass(java.lang.ClassLoader loader,
java.lang.String name,
byte[] classBytes,
boolean isRedefinition)
loader - the class loadername - the name of the class given in in the internal form of
fully qualified class and interface names as defined in The Java
Virtual Machine Specification, i.e. slashes instead of dots.classBytes - the loaded class as a byte arrayisRedefinition - true in case that the class is being
redefined / retransformed, false elseprivate byte[] transform0(java.lang.String name,
de.uni_hildesheim.sse.monitoring.runtime.instrumentation.lib.IClass cl,
TransformationType type)
AbstractClassTransformer.transform(String, IClass, TransformationType).name - the name of the class given in the
internal form of fully qualified class and interface names as defined
in The Java Virtual Machine Specification. For example,
"java/util/List".cl - the classtype - the type of the transformationprivate static final void log(java.lang.String text,
java.lang.Throwable th,
java.util.logging.Level level)
text - the message to be loggedth - the throwable to be consideredlevel - the logging levelprivate static java.lang.StackTraceElement getClosest(java.lang.StackTraceElement[] trace,
java.lang.String pkg)
trace which
relates to the given package pkg.trace - the trace to be analyzedpkg - the packageprotected void retransformAssigned(java.lang.String[] classNames)
retransformAssigned in class AbstractClassTransformerclassNames - the class names, values are ignored