![]() ![]() User interaction or to perform a long-running computation in a shutdown It is therefore inadvisable to attempt any Underlying operating system may only allow a fixed amount of time in Virtual machine is terminated due to user logoff or system shutdown the That the virtual machine will promptly shut down and exit. Shutdown hooks should also finish their work quickly. Services such as the AWT event-dispatch thread, for example, may lead to Have registered their own shutdown hooks and therefore may themselves in They should also not rely blindly upon services that may Particular, be written to be thread-safe and to avoid deadlocks insofarĪs possible. Machine and should therefore be coded defensively. Shutdown hooks run at a delicate time in the life cycle of a virtual New shutdown hook or de-register a previously-registered hook.Īttempting either of these operations will cause an Once the shutdown sequence has begun it is impossible to register a Once the shutdown sequence has begun it can be stopped only by Sequence, as will non-daemon threads if shutdown was initiated by Note that daemon threads will continue to run during the shutdown When all the hooks have finished it will then Start all registered shutdown hooks in some unspecified order and let When the virtual machine begins its shutdown sequence it will User interrupt, such as typing ^C, or a system-wide event,Ī shutdown hook is simply an initialized but unstarted The virtual machine is terminated in response to a.Thread exits or when the exit (equivalently, ![]() The program exits normally, when the last non-daemon.The Java virtual machine shuts down in response to two kinds Registers a new virtual-machine shutdown hook. Throws: SecurityException - If a security manager is present and itsĮxiting with the specified status See Also: Otherwise, this methodĬonventional and convenient means of invoking this method. Virtual machine with the given status code. If this method is invoked after all shutdown hooks have alreadyīeen run and the status is nonzero then this method halts the Serves as a status code by convention, a nonzero status code indicatesĪre started in some unspecified order and allowed to run concurrently Terminates the currently running Java virtual machine by initiating its ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |