Exemple #1
0
 /**
  * Tell the VM to run the finalize() method on every single Object before it exits. Note that the
  * JVM may still exit abnormally and not perform this, so you still don't have a guarantee. And
  * besides that, this is inherently unsafe in multi-threaded code, as it may result in deadlock as
  * multiple threads compete to manipulate objects. This value defaults to <code>false</code>.
  * There is a security check, <code>checkExit(0)</code>.
  *
  * @param finalizeOnExit whether to finalize all Objects on exit
  * @throws SecurityException if permission is denied
  * @see #exit(int)
  * @see #gc()
  * @since 1.1
  * @deprecated never rely on finalizers to do a clean, thread-safe, mop-up from your code
  */
 public static void runFinalizersOnExit(boolean finalizeOnExit) {
   SecurityManager sm = SecurityManager.current; // Be thread-safe!
   if (sm != null) sm.checkExit(0);
   current.finalizeOnExit = finalizeOnExit;
 }