ApplicationEngine

interface ApplicationEngine

Engine which runs an application

Types

Link copied to clipboard
open class Configuration

Configuration for the ApplicationEngine

Functions

Link copied to clipboard
abstract suspend fun resolvedConnectors(): List<EngineConnectorConfig>

Local addresses for application connectors. If environment's connectors was configured to use port=0, you can use this function to get an actual port for these connectors. Available after server was started.

Link copied to clipboard
abstract fun start(wait: Boolean = false): ApplicationEngine

Starts this ApplicationEngine

Link copied to clipboard
abstract fun stop(gracePeriodMillis: Long, timeoutMillis: Long)

Properties

Link copied to clipboard
open val application: <ERROR CLASS>

Currently running application instance

Link copied to clipboard
abstract val environment: ApplicationEngineEnvironment

Environment with which this engine is running

Inheritors

Link copied to clipboard

Extensions

Link copied to clipboard
expect fun ApplicationEngine.addShutdownHook(stop: () -> Unit)

Adds automatic application shutdown hooks management. Should be used before starting the engine. Once application termination noticed, stop block will be executed. Please note that a shutdown hook only registered when the application is running. If the application is already stopped then there will be no hook and no stop function invocation possible. So stop block will be called once or never.

actual fun ApplicationEngine.addShutdownHook(stop: () -> Unit)

Adds automatic JVM shutdown hooks management. Should be used before starting the engine. Once JVM termination noticed, stop block will be executed. Please note that a shutdown hook only registered when the application is running. If the application is already stopped then there will be no hook and no stop function invocation possible. So stop block will be called once or never.

actual fun ApplicationEngine.addShutdownHook(stop: () -> Unit)
Link copied to clipboard
fun ApplicationEngine.stop(gracePeriod: Long, timeout: Long, timeUnit: TimeUnit)
Link copied to clipboard
fun ApplicationEngine.stopServerOnCancellation(): <ERROR CLASS>

Stop server on job cancellation. The returned deferred need to be completed or cancelled.