src/share/classes/sun/misc/VM.java
Print this page
*** 146,169 ****
--- 146,185 ----
*/
// public native static void writeJavaProfilerReport();
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
// property in order to avoid doing things that should wait until the
// application class loader has been set up.
//
public static void booted() {
+ 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=<size>".
//
// The initial value of this field is arbitrary; during JRE initialization