Skip to content

Instantly share code, notes, and snippets.

@cap10morgan
Created February 20, 2014 22:44
Show Gist options
  • Save cap10morgan/9124854 to your computer and use it in GitHub Desktop.
Save cap10morgan/9124854 to your computer and use it in GitHub Desktop.
Graceful Jetty shutdown in pedestal-service 0.2.x
(ns myapp.service
(:require [io.pedestal.service.http :as bootstrap]))
(defn jetty-configurator [server]
(let [one-minute 60000]
(.setGracefulShutdown server one-minute)
(.setStopAtShutdown server true))
server)
(defn service []
{:env :prod
::bootstrap/routes routes
::bootstrap/resource-path "/public"
::bootstrap/host "0.0.0.0"
::bootstrap/type :jetty
::bootstrap/jetty-options {:configurator jetty-configurator} ; <- this sets the fn above as the Jetty configurator
::bootstrap/port 80})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment