src/java.base/share/classes/java/lang/Shutdown.java
changeset 49176 f413e471a6ab
parent 47216 71c04702a3d5
child 49186 b8bfadfacded
equal deleted inserted replaced
49175:6a5decfc5574 49176:f413e471a6ab
     1 /*
     1 /*
     2  * Copyright (c) 1999, 2005, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
   128                 }
   128                 }
   129             }
   129             }
   130         }
   130         }
   131     }
   131     }
   132 
   132 
       
   133     /* Notify the VM that it's time to halt. */
       
   134     static native void beforeHalt();
       
   135 
   133     /* The halt method is synchronized on the halt lock
   136     /* The halt method is synchronized on the halt lock
   134      * to avoid corruption of the delete-on-shutdown file list.
   137      * to avoid corruption of the delete-on-shutdown file list.
   135      * It invokes the true native halt method.
   138      * It invokes the true native halt method.
   136      */
   139      */
   137     static void halt(int status) {
   140     static void halt(int status) {
   207         }
   210         }
   208         synchronized (Shutdown.class) {
   211         synchronized (Shutdown.class) {
   209             /* Synchronize on the class object, causing any other thread
   212             /* Synchronize on the class object, causing any other thread
   210              * that attempts to initiate shutdown to stall indefinitely
   213              * that attempts to initiate shutdown to stall indefinitely
   211              */
   214              */
       
   215             beforeHalt();
   212             sequence();
   216             sequence();
   213             halt(status);
   217             halt(status);
   214         }
   218         }
   215     }
   219     }
   216 
   220