--- old/src/share/classes/sun/misc/VM.java 2013-11-01 14:00:18.000000000 -0700 +++ new/src/share/classes/sun/misc/VM.java 2013-11-01 14:00:18.000000000 -0700 @@ -148,6 +148,7 @@ private static volatile boolean booted = false; + private static final Object lock = new Object(); // Invoked by by System.initializeSystemClass just before returning. // Subsystems that are invoked during initialization can check this @@ -155,13 +156,28 @@ // application class loader has been set up. // public static void booted() { - booted = true; + synchronized (lock) { + booted = true; + lock.notifyAll(); + } } public static boolean isBooted() { return booted; } + // Waits until VM completes initialization + // + // This method is invoked by the Finalizer thread + public static boolean awaitBooted() throws InterruptedException { + synchronized (lock) { + while (!booted) { + lock.wait(); + } + } + return booted; + } + // A user-settable upper limit on the maximum amount of allocatable direct // buffer memory. This value may be changed during VM initialization if // "java" is launched with "-XX:MaxDirectMemorySize=".