Package org.jrd.agent

Class 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.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      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 getClassesNames​(java.util.concurrent.LinkedBlockingQueue<java.lang.String> queue, java.lang.Boolean abort)
      Inserts names of classes into queue.
      void setClassBody​(java.lang.String cname, byte[] nwBody)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • instrumentation

        private final java.lang.instrument.Instrumentation instrumentation
    • 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 retransformed
      • findClass

        private java.lang.Class findClass​(java.lang.String className)
      • getClassesNames

        public void getClassesNames​(java.util.concurrent.LinkedBlockingQueue<java.lang.String> queue,
                                    java.lang.Boolean abort)
                             throws java.lang.InterruptedException
        Inserts names of classes into queue. Stops execution when it receives abort signal.
        Parameters:
        queue - output queue
        abort - abort signal
        Throws:
        java.lang.InterruptedException