Class ServerExit
java.lang.Object
com.iizix.server.ServerExit
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 inmain; 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 uncaughtOutOfMemoryErrorand 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 andiiziServer.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
FieldsModifier and TypeFieldDescriptionstatic final intThe back-off of a supervisor between relaunches after a crash, in seconds.static final intThe relaunches a supervisor makes after crashes withinCRASH_WINDOW_SECONDSbefore it stops.static final intThe window ofCRASH_RELAUNCHES, in seconds.static final intA fatal error: no relaunch on POSIX; on Windows a crash (see the class comment).static final intThe Jakarta EE launcher's fatal exit: no relaunch (the supervisors treat it as fatal).static final intA parameter or configuration error at start: no relaunch.static final intRestart: the supervisor relaunches the server at once.static final intA normal stop: no relaunch.static final intUpdate and restart: the supervisor runs the updater, then relaunches the server.Method Summary
Modifier and TypeMethodDescriptionstatic Stringdescribe(int code) Describes an exit code for a log line.static booleanisCrash(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 booleanisNoRelaunch(int code) Checks if an exit code means "no relaunch": a normal stop or a fatal error.static booleanisRequestable(int code) Checks if an exit code is one the server itself requests throughServerShell: a stop or a restart.static booleanisRestart(int code) Checks if an exit code asks for a relaunch: a restart, with or without an update first.static booleanisUpdate(int code) Checks if an exit code asks for an update before the relaunch.
Field Details
STOP
public static final int STOPA normal stop: no relaunch.- See Also:
FATAL
public static final int FATALA fatal error: no relaunch on POSIX; on Windows a crash (see the class comment).- See Also:
JAKARTA_FATAL
public static final int JAKARTA_FATALThe Jakarta EE launcher's fatal exit: no relaunch (the supervisors treat it as fatal).- See Also:
PARAMETER_ERROR
public static final int PARAMETER_ERRORA parameter or configuration error at start: no relaunch. The server's existing code.- See Also:
RESTART
public static final int RESTARTRestart: the supervisor relaunches the server at once.- See Also:
UPDATE_RESTART
public static final int UPDATE_RESTARTUpdate and restart: the supervisor runs the updater, then relaunches the server.- See Also:
CRASH_BACKOFF_SECONDS
public static final int CRASH_BACKOFF_SECONDSThe back-off of a supervisor between relaunches after a crash, in seconds.- See Also:
CRASH_RELAUNCHES
public static final int CRASH_RELAUNCHESThe relaunches a supervisor makes after crashes withinCRASH_WINDOW_SECONDSbefore it stops.- See Also:
CRASH_WINDOW_SECONDS
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 throughServerShell: 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
Describes an exit code for a log line.- Parameters:
code- The exit code of the server process.- Returns:
- The description, e.g.
"restart (100)".