< prev index next >

src/share/classes/java/lang/Runtime.java

Print this page
rev 13766 : 8041626: Shutdown tracing event
Reviewed-by: dholmes, alanb, rriggs


 255      *         indicates abnormal termination.  If the <tt>{@link Runtime#exit
 256      *         exit}</tt> (equivalently, <tt>{@link System#exit(int)
 257      *         System.exit}</tt>) method has already been invoked then this
 258      *         status code will override the status code passed to that method.
 259      *
 260      * @throws SecurityException
 261      *         If a security manager is present and its <tt>{@link
 262      *         SecurityManager#checkExit checkExit}</tt> method does not permit
 263      *         an exit with the specified status
 264      *
 265      * @see #exit
 266      * @see #addShutdownHook
 267      * @see #removeShutdownHook
 268      * @since 1.3
 269      */
 270     public void halt(int status) {
 271         SecurityManager sm = System.getSecurityManager();
 272         if (sm != null) {
 273             sm.checkExit(status);
 274         }

 275         Shutdown.halt(status);
 276     }
 277 
 278     /**
 279      * Enable or disable finalization on exit; doing so specifies that the
 280      * finalizers of all objects that have finalizers that have not yet been
 281      * automatically invoked are to be run before the Java runtime exits.
 282      * By default, finalization on exit is disabled.
 283      *
 284      * <p>If there is a security manager,
 285      * its <code>checkExit</code> method is first called
 286      * with 0 as its argument to ensure the exit is allowed.
 287      * This could result in a SecurityException.
 288      *
 289      * @param value true to enable finalization on exit, false to disable
 290      * @deprecated  This method is inherently unsafe.  It may result in
 291      *      finalizers being called on live objects while other threads are
 292      *      concurrently manipulating those objects, resulting in erratic
 293      *      behavior or deadlock.
 294      *




 255      *         indicates abnormal termination.  If the <tt>{@link Runtime#exit
 256      *         exit}</tt> (equivalently, <tt>{@link System#exit(int)
 257      *         System.exit}</tt>) method has already been invoked then this
 258      *         status code will override the status code passed to that method.
 259      *
 260      * @throws SecurityException
 261      *         If a security manager is present and its <tt>{@link
 262      *         SecurityManager#checkExit checkExit}</tt> method does not permit
 263      *         an exit with the specified status
 264      *
 265      * @see #exit
 266      * @see #addShutdownHook
 267      * @see #removeShutdownHook
 268      * @since 1.3
 269      */
 270     public void halt(int status) {
 271         SecurityManager sm = System.getSecurityManager();
 272         if (sm != null) {
 273             sm.checkExit(status);
 274         }
 275         Shutdown.beforeHalt();
 276         Shutdown.halt(status);
 277     }
 278 
 279     /**
 280      * Enable or disable finalization on exit; doing so specifies that the
 281      * finalizers of all objects that have finalizers that have not yet been
 282      * automatically invoked are to be run before the Java runtime exits.
 283      * By default, finalization on exit is disabled.
 284      *
 285      * <p>If there is a security manager,
 286      * its <code>checkExit</code> method is first called
 287      * with 0 as its argument to ensure the exit is allowed.
 288      * This could result in a SecurityException.
 289      *
 290      * @param value true to enable finalization on exit, false to disable
 291      * @deprecated  This method is inherently unsafe.  It may result in
 292      *      finalizers being called on live objects while other threads are
 293      *      concurrently manipulating those objects, resulting in erratic
 294      *      behavior or deadlock.
 295      *


< prev index next >