Browse files

Added the option to use daemon threads in the pool

  • Loading branch information...
Josh Comer authored and jjcomer committed Sep 28, 2012
1 parent 76065ea commit 1fd697382ac5ad43e1d6abe01a72745c35217194
Showing with 6 additions and 2 deletions.
  1. +6 −2 ring-jetty-adapter/src/ring/adapter/jetty.clj
@@ -66,6 +66,7 @@
:port - the port to listen on (defaults to 80)
:host - the hostname to listen on
:join? - blocks the thread until server ends (defaults to true)
+ :daemon? - use daemon threads (defaults to false)
:ssl? - allow connections over HTTPS
:ssl-port - the SSL port to listen on (defaults to 443, implies :ssl?)
:keystore - the keystore to use for SSL connections
@@ -76,10 +77,13 @@
:client-auth - SSL client certificate authenticate, may be set to :need,
:want or :none (defaults to :none)"
[handler options]
- (let [^Server s (create-server (dissoc options :configurator))]
+ (let [^Server s (create-server (dissoc options :configurator))
+ ^QueuedThreadPool p (QueuedThreadPool. (options :max-threads 50))]
+ (when (:daemon? options false)
+ (.setDaemon p true))
(doto s
(.setHandler (proxy-handler handler))
- (.setThreadPool (QueuedThreadPool. (options :max-threads 50))))
+ (.setThreadPool p))
(when-let [configurator (:configurator options)]
(configurator s))
(.start s)

0 comments on commit 1fd6973

Please sign in to comment.