4200 THREAD); |
4200 THREAD); |
4201 if (shutdown_klass != NULL) { |
4201 if (shutdown_klass != NULL) { |
4202 // SystemDictionary::resolve_or_null will return null if there was |
4202 // SystemDictionary::resolve_or_null will return null if there was |
4203 // an exception. If we cannot load the Shutdown class, just don't |
4203 // an exception. If we cannot load the Shutdown class, just don't |
4204 // call Shutdown.shutdown() at all. This will mean the shutdown hooks |
4204 // call Shutdown.shutdown() at all. This will mean the shutdown hooks |
4205 // and finalizers (if runFinalizersOnExit is set) won't be run. |
4205 // won't be run. Note that if a shutdown hook was registered, |
4206 // Note that if a shutdown hook was registered or runFinalizersOnExit |
4206 // the Shutdown class would have already been loaded |
4207 // was called, the Shutdown class would have already been loaded |
4207 // (Runtime.addShutdownHook will load it). |
4208 // (Runtime.addShutdownHook and runFinalizersOnExit will load it). |
|
4209 JavaValue result(T_VOID); |
4208 JavaValue result(T_VOID); |
4210 JavaCalls::call_static(&result, |
4209 JavaCalls::call_static(&result, |
4211 shutdown_klass, |
4210 shutdown_klass, |
4212 vmSymbols::shutdown_method_name(), |
4211 vmSymbols::shutdown_method_name(), |
4213 vmSymbols::void_method_signature(), |
4212 vmSymbols::void_method_signature(), |
4226 // Shutdown sequence: |
4225 // Shutdown sequence: |
4227 // + Shutdown native memory tracking if it is on |
4226 // + Shutdown native memory tracking if it is on |
4228 // + Wait until we are the last non-daemon thread to execute |
4227 // + Wait until we are the last non-daemon thread to execute |
4229 // <-- every thing is still working at this moment --> |
4228 // <-- every thing is still working at this moment --> |
4230 // + Call java.lang.Shutdown.shutdown(), which will invoke Java level |
4229 // + Call java.lang.Shutdown.shutdown(), which will invoke Java level |
4231 // shutdown hooks, run finalizers if finalization-on-exit |
4230 // shutdown hooks |
4232 // + Call before_exit(), prepare for VM exit |
4231 // + Call before_exit(), prepare for VM exit |
4233 // > run VM level shutdown hooks (they are registered through JVM_OnExit(), |
4232 // > run VM level shutdown hooks (they are registered through JVM_OnExit(), |
4234 // currently the only user of this mechanism is File.deleteOnExit()) |
4233 // currently the only user of this mechanism is File.deleteOnExit()) |
4235 // > stop StatSampler, watcher thread, CMS threads, |
4234 // > stop StatSampler, watcher thread, CMS threads, |
4236 // post thread end and vm death events to JVMTI, |
4235 // post thread end and vm death events to JVMTI, |