Class ServiceStopWatcher

java.lang.Object
com.iizix.server.ServiceStopWatcher

public final class ServiceStopWatcher extends Object
The server's side of a graceful Windows service stop (CC-SERVER-RESTART-UPDATE-V5, stage-native): under the service wrapper (-supervisor wrapper) a daemon thread polls the file "server.stop" in the server's current directory, which the wrapper writes when SrvAny signals a service STOP; the server then asks itself to stop - exit code 0 through its dispose, every client told - instead of being killed. The file is deleted when it is acted on, so that a stale one never stops the next start. The old SrvAny kills the process tree instead: this watcher then never sees a file, and nothing is lost.
Author:
Christopher Mindus
  • Field Details

    • FILE

      public static final String FILE
      The file the wrapper writes: server.stop in the server's current directory.
      See Also:
  • Method Details

    • start

      public static Thread start(ServerShell server)
      Starts the watcher for a server.
      Parameters:
      server - The server.
      Returns:
      The thread, started and daemon.