Skip to content
This repository has been archived by the owner on Jun 15, 2024. It is now read-only.

Commit

Permalink
add shutdown hook to execute shutdown sequence on jvm shutdown (#103)
Browse files Browse the repository at this point in the history
  • Loading branch information
flosell committed Apr 3, 2016
1 parent 856ac16 commit f5f5029
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/clj/lambdacd/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@

(defn- add-shutdown-sequence! [ctx]
(doto (Runtime/getRuntime)
(.addShutdownHook (fn []
((:shutdown-sequence (:config ctx)) ctx)))))
(.addShutdownHook (Thread. (fn []
(log/info "Shutting down LambdaCD...")
((:shutdown-sequence (:config ctx)) ctx)))))
ctx)

(def default-shutdown-sequence
(fn [ctx]
Expand All @@ -35,7 +37,8 @@
(event-bus/initialize-event-bus)
(running-builds-tracking/initialize-running-builds-tracking)
(assoc :pipeline-state-component pipeline-state-component)
(initialize-pipeline-state-updater))]
(initialize-pipeline-state-updater)
(add-shutdown-sequence!))]
{:context context
:pipeline-def pipeline-def})))

Expand Down

0 comments on commit f5f5029

Please sign in to comment.