Created
January 19, 2017 16:06
-
-
Save dball/28fae154b7d8db0e6d5f763a8738f551 to your computer and use it in GitHub Desktop.
This file contains 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