Skip to content

Instantly share code, notes, and snippets.

@dball
Created January 19, 2017 16:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dball/28fae154b7d8db0e6d5f763a8738f551 to your computer and use it in GitHub Desktop.
Save dball/28fae154b7d8db0e6d5f763a8738f551 to your computer and use it in GitHub Desktop.
(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