Is there more elegant way to attach a shutdown hoo...
# announcements
a
Is there more elegant way to attach a shutdown hook in kotlin, like lambda functions or so? Currently using this (not looks so beautiful :P)
Copy code
Runtime.getRuntime().addShutdownHook(object : Thread() {
	override fun run() {
		server.destroy()
	}
})
i
Copy code
Runtime.getRuntime().addShutdownHook(Thread { server.destroy() })
a
Thanks! 😉
d
thread(start = false) { server.destroy() }
Does the uppercase thread thing work?
a
Yeah :)
d
Nice
942 Views