Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
(defmethod perform :start
[_ config components roles]
(println "Starting persistent service" components)
(let [system (volatile! (system/create-system config components roles))
runtime (Runtime/getRuntime)
shutdown? (promise)]
(.addShutdownHook runtime
(Thread. (fn []
(println "Shutting down persistent service")
(system/stop @system)
(println "Shut down cleanly")
(deliver shutdown? true))))
(vswap! system system/start)
@shutdown?))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment