Class InstrumentationFactory


  • public class InstrumentationFactory
    extends java.lang.Object
    Factory for obtaining an Instrumentation instance.
    Since:
    1.0.0
    Author:
    Marc Prud'hommeaux
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void agentmain​(java.lang.String agentArgs, java.lang.instrument.Instrumentation inst)
      The method that is called when a jar is added as an agent at runtime.
      static java.lang.instrument.Instrumentation getInstrumentation​(Log log)  
      static void setDynamicallyInstallAgent​(boolean val)
      Configures whether or not this instance should attempt to dynamically install an agent in the VM.
      static void setInstrumentation​(java.lang.instrument.Instrumentation inst)
      This method is not synchronized because when the agent is loaded from getInstrumentation() that method will cause agentmain(..) to be called.
      • Methods inherited from class java.lang.Object

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

      • InstrumentationFactory

        public InstrumentationFactory()
    • Method Detail

      • setInstrumentation

        public static void setInstrumentation​(java.lang.instrument.Instrumentation inst)
        This method is not synchronized because when the agent is loaded from getInstrumentation() that method will cause agentmain(..) to be called. Synchronizing this method would cause a deadlock.
        Parameters:
        inst - The instrumentation instance to be used by this factory.
      • setDynamicallyInstallAgent

        public static void setDynamicallyInstallAgent​(boolean val)
        Configures whether or not this instance should attempt to dynamically install an agent in the VM. Defaults to true.
      • getInstrumentation

        public static java.lang.instrument.Instrumentation getInstrumentation​(Log log)
        Parameters:
        log - OpenJPA log.
        Returns:
        null if Instrumentation can not be obtained, or if any Exceptions are encountered.
      • agentmain

        public static void agentmain​(java.lang.String agentArgs,
                                     java.lang.instrument.Instrumentation inst)
        The method that is called when a jar is added as an agent at runtime. All this method does is store the Instrumentation for later use.