scala - Stop Application -
i have main function used play.core.server.prodserverstart start application. 1 know how stop server or let main exit gracefully? using play 2.4. thanks!
here main function:
object test { def main (args: array[string]) { play.core.server.prodserverstart.main(array()) println("main in test") println("main finishes, want exit") // how stop? } }
play.core.server.prodserverstart.main(array())
returns object of type serverwithstop
(source). try assigning result variable server
, calling server.stop()
:
object test { def main (args: array[string]) { val server = play.core.server.prodserverstart.main(array()) println("main in test") println("main finishes, want exit") server.stop() } }
Comments
Post a Comment