void exit()

in nailgun-server/src/main/java/com/facebook/nailgun/NGCommunicator.java [325:353]


  void exit(int exitCode) {
    if (isExited) {
      return;
    }
    // First, stop reading from the socket. If we won't do that then client receives an exit code
    // and terminates
    // the socket on its end, causing readExecutor to throw
    try {
      stopIn();
    } catch (IOException ex) {
      LOG.log(
          Level.WARNING, "Unable to close socket for reading while sending final exit code", ex);
    }

    // send the command - client will exit
    try (PrintStream exit = new PrintStream(new NGOutputStream(this, NGConstants.CHUNKTYPE_EXIT))) {
      exit.println(exitCode);
    }
    isExited = true;

    // close writing too - there is no point to send anything to client after the resulting exit
    // code
    try {
      stopOut();
    } catch (IOException ex) {
      LOG.log(
          Level.WARNING, "Unable to close socket for writing while sending final exit code", ex);
    }
  }