mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 14:54:52 +02:00
8288984: Simplification in java.lang.Runtime::exit
Reviewed-by: dholmes, chegar, alanb, kbarrett
This commit is contained in:
parent
393dc7ade7
commit
ea12615d2f
2 changed files with 5 additions and 10 deletions
|
@ -83,10 +83,11 @@ public class Runtime {
|
|||
* until they finish. Once this is done the virtual machine
|
||||
* {@linkplain #halt halts}.
|
||||
*
|
||||
* <p> If this method is invoked after all shutdown hooks have already
|
||||
* been run and the status is nonzero then this method halts the
|
||||
* virtual machine with the given status code. Otherwise, this method
|
||||
* blocks indefinitely.
|
||||
* <p> Invocations of this method are serialized such that only one
|
||||
* invocation will actually proceed with the shutdown sequence and
|
||||
* terminate the VM with the given status code. All other invocations
|
||||
* will block indefinitely. If this method is invoked from a shutdown
|
||||
* hook the system will deadlock.
|
||||
*
|
||||
* <p> The {@link System#exit(int) System.exit} method is the
|
||||
* conventional and convenient means of invoking this method.
|
||||
|
|
|
@ -159,12 +159,6 @@ class Shutdown {
|
|||
* which should pass a nonzero status code.
|
||||
*/
|
||||
static void exit(int status) {
|
||||
synchronized (lock) {
|
||||
if (status != 0 && VM.isShutdown()) {
|
||||
/* Halt immediately on nonzero status */
|
||||
halt(status);
|
||||
}
|
||||
}
|
||||
synchronized (Shutdown.class) {
|
||||
/* Synchronize on the class object, causing any other thread
|
||||
* that attempts to initiate shutdown to stall indefinitely
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue