src/share/classes/sun/misc/VM.java
Print this page
@@ -145,24 +145,41 @@
* If the file already exists, it will be overwritten.
*/
// public native static void writeJavaProfilerReport();
- private static volatile boolean booted = false;
+ private static 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() {
+ synchronized (lock) {
return booted;
}
+ }
+
+ // Waits until VM completes initialization
+ //
+ // This method is invoked by the Finalizer thread
+ public static void awaitBooted() throws InterruptedException {
+ synchronized (lock) {
+ while (!booted) {
+ lock.wait();
+ }
+ }
+ }
// 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>".
//