dave08
04/19/2018, 1:19 PMDeactivated User
04/19/2018, 1:25 PMctrl/cmd+click
dave08
04/19/2018, 1:26 PMdave08
04/19/2018, 1:26 PMDeactivated User
04/19/2018, 1:26 PMDeactivated User
04/19/2018, 1:35 PMhttp://oi63.tinypic.com/2a4twsk.jpg▾
dave08
04/19/2018, 1:38 PMstart(false)
, start(true)
, if the second one fails for any reason, the first one will also go down? Would there be a fault tolerant way of keeping any healthy one alive?Deactivated User
04/19/2018, 1:58 PMfun main(args: Array<String>) {
val engineApi = embeddedServer(Netty, port = 8080, module = Application::apiModule)
val engineInternal = embeddedServer(Netty, port = 9090, module = Application::internalModule)
val engineApiStopDeferred = CompletableDeferred<Unit>()
val engineInternalStopDeferred = CompletableDeferred<Unit>()
engineApi.environment.monitor.subscribe(ApplicationStopped) { engineApiStopDeferred.complete(Unit) }
engineInternal.environment.monitor.subscribe(ApplicationStopped) { engineInternalStopDeferred.complete(Unit) }
try { engineApi.start(wait = false) } catch (e: Throwable) { e.printStackTrace() }
try { engineInternal.start(wait = false) } catch (e: Throwable) { e.printStackTrace() }
runBlocking {
engineApiStopDeferred.await()
engineInternalStopDeferred.await()
}
}
dave08
04/19/2018, 3:15 PMdave08
04/19/2018, 3:19 PM