Table of Contents

Interface IServerStateProvider

Namespace
RDCore.SDK.Server.Services.States
Assembly
RDCore.SDK.dll

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

CancellationTokenSource

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

CancellationTokenSource

State

Gets the current ServerState.

ServerState State { get; }

Property Value

ServerState

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

InvalidServerStateException

OnInitialize()

Sets the server state to InitializingServerState if the current state is StartingServerState, otherwise throws an InvalidServerStateException.

void OnInitialize()

Exceptions

InvalidServerStateException

OnInitialized()

Sets the server state to RunningServerState if the current state is InitializingServerState, otherwise throws an InvalidServerStateException.

void OnInitialized()

Exceptions

InvalidServerStateException

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

InvalidServerStateException

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()