Package org.jrd.agent
Class InstrumentationProvider
- java.lang.Object
-
- org.jrd.agent.InstrumentationProvider
-
public class InstrumentationProvider extends java.lang.Object
This class stores instrumentation and transformer objects and handles the transformation, retrieval of bytecode and class names.
-
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.String
INFO_DELIMITER
private java.lang.instrument.Instrumentation
instrumentation
private Transformer
transformer
-
Constructor Summary
Constructors Constructor Description InstrumentationProvider(java.lang.instrument.Instrumentation inst, Transformer transformer)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
cleanOverrides(java.lang.String pattern)
private java.lang.Class
findClass(java.lang.String className)
byte[]
findClassBody(java.lang.String className)
Finds class object corresponding to the class name and returns its bytecode.private byte[]
getClassBody(java.lang.Class clazz)
void
getClasses(java.util.concurrent.BlockingQueue<java.lang.String> queue, java.lang.Boolean abort, boolean doGetInfo)
Inserts names of classes into queue.void
getOverrides(java.util.concurrent.BlockingQueue<java.lang.String> queue)
void
setClassBody(java.lang.String cname, byte[] nwBody)
-
-
-
Field Detail
-
transformer
private final Transformer transformer
-
instrumentation
private final java.lang.instrument.Instrumentation instrumentation
-
INFO_DELIMITER
private static final java.lang.String INFO_DELIMITER
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
InstrumentationProvider
InstrumentationProvider(java.lang.instrument.Instrumentation inst, Transformer transformer)
-
-
Method Detail
-
setClassBody
public void setClassBody(java.lang.String cname, byte[] nwBody) throws java.lang.instrument.UnmodifiableClassException
- Throws:
java.lang.instrument.UnmodifiableClassException
-
getClassBody
private byte[] getClassBody(java.lang.Class clazz) throws java.lang.instrument.UnmodifiableClassException
- Throws:
java.lang.instrument.UnmodifiableClassException
-
findClassBody
public byte[] findClassBody(java.lang.String className) throws java.lang.instrument.UnmodifiableClassException
Finds class object corresponding to the class name and returns its bytecode.- Parameters:
className
- name of class we want to get- Returns:
- bytecode of given class
- Throws:
java.lang.instrument.UnmodifiableClassException
- if the class can not be re-transformed
-
findClass
private java.lang.Class findClass(java.lang.String className)
-
getClasses
public void getClasses(java.util.concurrent.BlockingQueue<java.lang.String> queue, java.lang.Boolean abort, boolean doGetInfo) throws java.lang.InterruptedException
Inserts names of classes into queue. Stops execution when it receives abort signal.- Parameters:
queue
- output queueabort
- abort signal- Throws:
java.lang.InterruptedException
- interrupted exception
-
getOverrides
public void getOverrides(java.util.concurrent.BlockingQueue<java.lang.String> queue) throws java.lang.InterruptedException
- Throws:
java.lang.InterruptedException
-
cleanOverrides
public int cleanOverrides(java.lang.String pattern)
-
-