Ejemplo n.º 1
0
 // Accessor to avoid adding a vtable slot.
 static void exitNoChecksAccessor(int status) {
   current.exitNoChecks(status);
 }
Ejemplo n.º 2
0
 /**
  * Exit the Java runtime. This method will either throw a SecurityException or it will never
  * return. The status code is returned to the system; often a non-zero status code indicates an
  * abnormal exit. Of course, there is a security check, <code>checkExit(status)</code>.
  *
  * <p>First, all shutdown hooks are run, in unspecified order, and concurrently. Next, if
  * finalization on exit has been enabled, all pending finalizers are run. Finally, the system
  * calls <code>halt</code>.
  *
  * <p>If this is run a second time after shutdown has already started, there are two actions. If
  * shutdown hooks are still executing, it blocks indefinitely. Otherwise, if the status is nonzero
  * it halts immediately; if it is zero, it blocks indefinitely. This is typically called by <code>
  * System.exit</code>.
  *
  * @param status the status to exit with
  * @throws SecurityException if permission is denied
  * @see #addShutdownHook(Thread)
  * @see #runFinalizersOnExit(boolean)
  * @see #runFinalization()
  * @see #halt(int)
  */
 public void exit(int status) {
   SecurityManager sm = SecurityManager.current; // Be thread-safe!
   if (sm != null) sm.checkExit(status);
   exitNoChecks(status);
 }