DestroyJavaVM
This method can be called from the launcher to tear down the VM, it can also be called by the VM itself when a very serious error occurs.
The tear down of the VM takes the following steps:
-
- Wait until we are the last non-daemon thread to execute, noting that the VM is still functional.
-
- Call java.lang.Shutdown.shutdown(), which will invoke Java level shutdown hooks, run finalizers if finalization-on-exit.
-
- Call before_exit(), prepare for VM exit run VM level shutdown hooks (they are registered through JVM_OnExit()), stop theProfiler, StatSampler, Watcher and GC threads. Post the status events to JVMTI/PI, disable JVMPI, and stop the Signal thread.
-
- Call JavaThread::exit(), to release JNI handle blocks, remove stack guard pages, and remove this thread from Threads list. From this point on we cannot execute any more Java code.
-
- Stop VM thread, it will bring the remaining VM to a safepoint and stop the compiler threads. At a safepoint, care should that we should not use anything that could get blocked by a Safepoint.
-
- Disable tracing at JNI/JVM/JVMPI barriers.
-
- Set _vm_exited flag for threads that are still running native code.
-
- Delete this thread.
-
- Call exit_globals(), which deletes IO and PerfMemory resources.
-
- Return to caller.
No comments:
Post a Comment