Created
February 1, 2018 02:33
-
-
Save dball/21eaa1f003c03217bdad83c03571669b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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