Determine the end of the JVM boot phase

Is there any way to detect the end of the JVM boot phase?

edit ::

therefore, to provide a little more context, I am trying to do this for the JDK. And this is a full-featured instrument that writes every LOAD, STORE, INVOKE byte instruction. As instructions are executed, their data is sent to the static method, which is loaded from the xbootclasspath. This static method captures all this information and saves it all as a trace for analysis at a later time.

Now, when I do this for the JDK, I don’t want to violate the way classes are loaded into the JVM, which can lead to a program crash. I assumed that the best way to do this is to determine the point in time when the JVM is self-tuning, so that I can safely turn on my toolkit after that. (I plan not to use any code while self-tuning is in progress). Is this even the right way to do this?

+5
source share
1 answer

In addition to my previous comment on viewing FERRARI and MAJOR I want to say a few things:

  • Both tools are only available as compiled Java JAR archives.
  • , , , . , .
  • , FERRARI , , , , .

, ( ) , :

  • JDK.
  • BootstrapLock, .
  • + rt.jar.
  • Java-, .
public class BootstrapLock {
    private static volatile boolean inBootstrap = true;

    public static boolean inBootstrap() {
        return inBootstrap;
    }

    public static synchronized void setEndOfBS() {
        inBootstrap = false;
    }
}

public class DummyAgent {
    public static void premain(String options, Instrumentation ins) {
        BootstrapLock.setEndOfBS();
    }
}

, :

  • , .
  • , , , , .
  • , inBootstrap.
  • , , .

, , , , , , , , , , . ...


: FERRARI . java- JVM, . , , , JVM. , , . .

+2

All Articles