Interface IServerStateProvider
Defines methods for managing and transitioning the operational lifecycle state of a ServerApp instance.
public interface IServerStateProvider
Properties
ProcessTokenSource
Gets the CancellationTokenSource that expires when an Exit notification is handled.
CancellationTokenSource ProcessTokenSource { get; }
Property Value
Remarks
⚠️ This token terminates the server process. The process should exit with the current ExitCode.
ShutdownRequestTokenSource
Gets a CancellationTokenSource that expires when a Shutdown request is handled.
CancellationTokenSource ShutdownRequestTokenSource { get; }
Property Value
State
Gets the current ServerState.
ServerState State { get; }
Property Value
Methods
OnExit()
Sets the server state to ExitingServerState if the current state is StartingServerState or ShuttingDown, otherwise throws an InvalidServerStateException;
cancels the ProcessToken (causes an immediate process exit).
void OnExit()
Exceptions
OnInitialize()
Sets the server state to InitializingServerState if the current state is StartingServerState, otherwise throws an InvalidServerStateException.
void OnInitialize()
Exceptions
OnInitialized()
Sets the server state to RunningServerState if the current state is InitializingServerState, otherwise throws an InvalidServerStateException.
void OnInitialized()
Exceptions
OnShutdown()
Sets the server state to ShuttingDown if the current state is StartingServerState or RunningServerState,
otherwise throws an InvalidServerStateException; cancels the RequestToken.
void OnShutdown()
Exceptions
OnTraceMessages()
Sets the server state to RunningServerState with tracing enabled.
void OnTraceMessages()
OnTraceOff()
Sets the server state to RunningTracelessServerState.
void OnTraceOff()
OnTraceVerbose()
Sets the server state to RunningServerState with verbose tracing enabled.
void OnTraceVerbose()