Vinicius Carvalho
03/13/2019, 2:50 PMribesg
03/13/2019, 2:56 PM.stop()
function is called on the app.stop()
function, if it existsVinicius Carvalho
03/13/2019, 3:41 PMembeddedServer
combined with some shutdownHook on the main thread to capture those signals, but I wonder why ain't this the default?ribesg
03/13/2019, 3:55 PMVinicius Carvalho
03/13/2019, 4:11 PMval server = embeddedServer(Netty, port = 8080){
environment.monitor.subscribe(ApplicationStopping){
println("Cleaning up")
}
}.start(false)
Runtime.getRuntime().addShutdownHook(Thread {
server.stop(1, 5, TimeUnit.SECONDS)
})
Thread.currentThread().join()