Package com.caucho.env.shutdown

Examples of com.caucho.env.shutdown.ShutdownSystem


  void waitForExit()
  {
    int socketExceptionCount = 0;
    Runtime runtime = Runtime.getRuntime();
   
    ShutdownSystem shutdown = _resinSystem.getService(ShutdownSystem.class);
   
    if (shutdown == null) {
      throw new IllegalStateException(L.l("'{0}' requires an active {1}",
                                          this,
                                          ShutdownSystem.class.getSimpleName()));
    }
   
    /*
     * If the server has a parent process watching over us, close
     * gracefully when the parent dies.
     */
    while (! _resin.isClosing()) {
      try {
        Thread.sleep(10);
       
        if (! checkMemory(runtime)) {
          shutdown.shutdown(ExitCode.MEMORY, "Resin shutdown from out of memory");
          // dumpHeapOnExit();
          return;
        }
       
        if (! checkFileDescriptor()) {
          shutdown.shutdown(ExitCode.MEMORY,
                            "Resin shutdown from out of file descriptors");
          //dumpHeapOnExit();
          return;
        }
       
        if (_waitIn != null) {
          if (_waitIn.read() >= 0) {
            socketExceptionCount = 0;
          }
          else {
            shutdown.shutdown(ExitCode.WATCHDOG_EXIT,
                              "Stopping due to watchdog or user.");
           
            return;
          }
        }
View Full Code Here

TOP

Related Classes of com.caucho.env.shutdown.ShutdownSystem

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.