Ejemplo n.º 1
0
 /** Blocks until all processes are terminated. */
 public void stop() {
   trace("start hard stop async...");
   stopAsync(State.HARD_STOPPING);
   trace("await termination of terminator...");
   awaitTermination(terminator);
   cleanAfterTermination();
   trace("exit...");
   systemExit.exit(0);
 }
Ejemplo n.º 2
0
 private void cleanAfterTermination() {
   trace("go to STOPPED...");
   if (lifecycle.tryToMoveTo(State.STOPPED)) {
     trace("await termination of restartWatcher and hardStopWatcher...");
     // wait for restartWatcher and hardStopWatcher to cleanly stop
     awaitTermination(restartWatcher, hardStopWatcher);
     trace("restartWatcher done");
     // removing shutdown hook to avoid called stop() unnecessarily unless already in shutdownHook
     if (!systemExit.isInShutdownHook()) {
       trace("removing shutdown hook...");
       Runtime.getRuntime().removeShutdownHook(shutdownHook);
     }
     // cleanly close JavaLauncher
     closeJavaLauncher();
   }
 }