Class ServerExit

java.lang.Object
com.iizix.server.ServerExit

public final class ServerExit extends Object
The exit-code contract between the server process and whatever supervises it: the POSIX iiziServer.sh loop, the Windows iiziServer.bat loop, the Java service wrapper under SrvAny, the systemd unit and iiziGo's development-server launch (order CC-SERVER-RESTART-UPDATE-V5, the owner's rulings of 2026-10-11 at 19:05 and 19:30).

Every code is the same on every platform and stays below 256, because some Linux and macOS shells truncate an exit value to a byte:

  • STOP (0): a normal stop. No relaunch.
  • FATAL (1): a fatal error. No relaunch. The JVM itself ends with 1 after an uncaught exception in main; the updater and the wrapper exit 1 for their own fatal errors. On Windows 1 is a crash as well: a JVM crash (hs_err), an uncaught OutOfMemoryError and a kill (TerminateProcess) end the process with 1 there (measured on JDK 8 to 26, CC-NP-UPGRADE-FOLLOWUP NP-F-1), so the Windows supervisors - the service wrapper and iiziServer.bat - cannot tell them from a fatal error and treat 1 as a crash (CC-FIX-WRAPPER-RELAUNCH, ruled 2026-10-21). The methods below are the POSIX reading, where a crash or a kill ends with 128 + a signal.
  • JAKARTA_FATAL (8): the Jakarta EE launcher's fatal exit, treated as fatal by the supervisors. The server never produces it.
  • PARAMETER_ERROR (9): a parameter or configuration error at start, the server's existing fatal exit (JettyRunConfiguration.main, the licence callback without a server). No relaunch. It is NOT renumbered.
  • RESTART (100): restart, the supervisor relaunches at once.
  • UPDATE_RESTART (101): update, then restart: the supervisor runs the updater first.
  • Anything else is a crash or a kill (128 + a signal, a Windows NTSTATUS, the event-log DLL's 10): the supervisor relaunches with a back-off of 10 seconds, at most 5 relaunches in 300 seconds, then it stops.

The methods are the contract; a test resolves them at run time rather than the constants, which the compiler inlines.

Author:
Christopher Mindus
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    The back-off of a supervisor between relaunches after a crash, in seconds.
    static final int
    The relaunches a supervisor makes after crashes within CRASH_WINDOW_SECONDS before it stops.
    static final int
    The window of CRASH_RELAUNCHES, in seconds.
    static final int
    A fatal error: no relaunch on POSIX; on Windows a crash (see the class comment).
    static final int
    The Jakarta EE launcher's fatal exit: no relaunch (the supervisors treat it as fatal).
    static final int
    A parameter or configuration error at start: no relaunch.
    static final int
    Restart: the supervisor relaunches the server at once.
    static final int
    A normal stop: no relaunch.
    static final int
    Update and restart: the supervisor runs the updater, then relaunches the server.
  • Method Summary

    Modifier and Type
    Method
    Description
    static String
    describe(int code)
    Describes an exit code for a log line.
    static boolean
    isCrash(int code)
    Checks if an exit code is a crash or a kill: everything that is neither a "no relaunch" code nor a restart.
    static boolean
    isNoRelaunch(int code)
    Checks if an exit code means "no relaunch": a normal stop or a fatal error.
    static boolean
    isRequestable(int code)
    Checks if an exit code is one the server itself requests through ServerShell: a stop or a restart.
    static boolean
    isRestart(int code)
    Checks if an exit code asks for a relaunch: a restart, with or without an update first.
    static boolean
    isUpdate(int code)
    Checks if an exit code asks for an update before the relaunch.
  • Field Details

    • STOP

      public static final int STOP
      A normal stop: no relaunch.
      See Also:
    • FATAL

      public static final int FATAL
      A fatal error: no relaunch on POSIX; on Windows a crash (see the class comment).
      See Also:
    • JAKARTA_FATAL

      public static final int JAKARTA_FATAL
      The Jakarta EE launcher's fatal exit: no relaunch (the supervisors treat it as fatal).
      See Also:
    • PARAMETER_ERROR

      public static final int PARAMETER_ERROR
      A parameter or configuration error at start: no relaunch. The server's existing code.
      See Also:
    • RESTART

      public static final int RESTART
      Restart: the supervisor relaunches the server at once.
      See Also:
    • UPDATE_RESTART

      public static final int UPDATE_RESTART
      Update and restart: the supervisor runs the updater, then relaunches the server.
      See Also:
    • CRASH_BACKOFF_SECONDS

      public static final int CRASH_BACKOFF_SECONDS
      The back-off of a supervisor between relaunches after a crash, in seconds.
      See Also:
    • CRASH_RELAUNCHES

      public static final int CRASH_RELAUNCHES
      The relaunches a supervisor makes after crashes within CRASH_WINDOW_SECONDS before it stops.
      See Also:
    • CRASH_WINDOW_SECONDS

      public static final int CRASH_WINDOW_SECONDS
      The window of CRASH_RELAUNCHES, in seconds.
      See Also:
  • Method Details

    • isNoRelaunch

      public static boolean isNoRelaunch(int code)
      Checks if an exit code means "no relaunch": a normal stop or a fatal error.
      Parameters:
      code - The exit code of the server process.
      Returns:
      true for 0, 1, 8 and 9.
    • isRestart

      public static boolean isRestart(int code)
      Checks if an exit code asks for a relaunch: a restart, with or without an update first.
      Parameters:
      code - The exit code of the server process.
      Returns:
      true for 100 and 101.
    • isUpdate

      public static boolean isUpdate(int code)
      Checks if an exit code asks for an update before the relaunch.
      Parameters:
      code - The exit code of the server process.
      Returns:
      true for 101.
    • isCrash

      public static boolean isCrash(int code)
      Checks if an exit code is a crash or a kill: everything that is neither a "no relaunch" code nor a restart. The supervisor relaunches with the back-off.
      Parameters:
      code - The exit code of the server process.
      Returns:
      true for every code but 0, 1, 8, 9, 100 and 101.
    • isRequestable

      public static boolean isRequestable(int code)
      Checks if an exit code is one the server itself requests through ServerShell: a stop or a restart. The fatal codes are produced where the error is found, never requested.
      Parameters:
      code - The exit code.
      Returns:
      true for 0, 100 and 101.
    • describe

      public static String describe(int code)
      Describes an exit code for a log line.
      Parameters:
      code - The exit code of the server process.
      Returns:
      The description, e.g. "restart (100)".