Class PreMain


  • public final class PreMain
    extends java.lang.Object
    The agent which is referred as the Premain-Class. The agent configuration is provided with the agent parameters in the command line.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private PreMain()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      private static IRuntime createRuntime​(java.lang.instrument.Instrumentation inst)  
      private static java.lang.Object getModule​(java.lang.Class<?> cls)  
      static void premain​(java.lang.String options, java.lang.instrument.Instrumentation inst)
      This method is called by the JVM to initialize Java agents.
      private static boolean redefineJavaBaseModule​(java.lang.instrument.Instrumentation instrumentation)
      Opens java.base module for InjectedClassRuntime when executed on Java 9 JREs or higher.
      • Methods inherited from class java.lang.Object

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

      • PreMain

        private PreMain()
    • Method Detail

      • premain

        public static void premain​(java.lang.String options,
                                   java.lang.instrument.Instrumentation inst)
                            throws java.lang.Exception
        This method is called by the JVM to initialize Java agents.
        Parameters:
        options - agent options
        inst - instrumentation callback provided by the JVM
        Throws:
        java.lang.Exception - in case initialization fails
      • createRuntime

        private static IRuntime createRuntime​(java.lang.instrument.Instrumentation inst)
                                       throws java.lang.Exception
        Throws:
        java.lang.Exception
      • redefineJavaBaseModule

        private static boolean redefineJavaBaseModule​(java.lang.instrument.Instrumentation instrumentation)
                                               throws java.lang.Exception
        Opens java.base module for InjectedClassRuntime when executed on Java 9 JREs or higher.
        Returns:
        true when running on Java 9 or higher, false otherwise
        Throws:
        java.lang.Exception - if unable to open
      • getModule

        private static java.lang.Object getModule​(java.lang.Class<?> cls)
                                           throws java.lang.Exception
        Returns:
        cls.getModule()
        Throws:
        java.lang.Exception