while (true) try { exitSequence.join(); } catch (InterruptedException e) {    } }
while (shutdownHooks != null) { try { exitSequence.join(); } catch (InterruptedException e) {    } }  halt(status); }
  public void exit(int status)  {    SecurityManager sm = SecurityManager.current; // Be thread-safe!    if (sm != null)      sm.checkExit(status);    if (runShutdownHooks())      halt(status);    // Someone else already called runShutdownHooks().    // Make sure we are not/no longer in the shutdownHooks set.    // And wait till the thread that is calling runShutdownHooks() finishes.    synchronized (libpath)      {        if (shutdownHooks != null)          {            shutdownHooks.remove(Thread.currentThread());            // Interrupt the exit sequence thread, in case it was waiting            // inside a join on our thread.            exitSequence.interrupt();	    // Shutdown hooks are still running, so we clear status to	    // make sure we don't halt.	    status = 0;          }      }    // If exit() is called again after the shutdown hooks have run, but    // while finalization for exit is going on and the status is non-zero    // we halt immediately.    if (status != 0)      halt(status);    while (true)      try        {          exitSequence.join();        }      catch (InterruptedException e)        {          // Ignore, we've suspended indefinitely to let all shutdown          // hooks complete, and to let any non-zero exits through, because          // this is a duplicate call to exit(0).        }		}