Permalink
Browse files

Added :max-threads option to Jetty adapter (fixes #48)

  • Loading branch information...
1 parent b6e89d3 commit 9adf1e6b4ec16360c4c960fc4bfa4afc0e31000e @weavejester weavejester committed Jan 1, 2012
Showing with 4 additions and 1 deletion.
  1. +4 −1 ring-jetty-adapter/src/ring/adapter/jetty.clj
View
5 ring-jetty-adapter/src/ring/adapter/jetty.clj
@@ -4,6 +4,7 @@
(org.mortbay.jetty Server Request Response)
(org.mortbay.jetty.bio SocketConnector)
(org.mortbay.jetty.security SslSocketConnector)
+ (org.mortbay.thread QueuedThreadPool)
(javax.servlet.http HttpServletRequest HttpServletResponse))
(:require [ring.util.servlet :as servlet]))
@@ -59,13 +60,15 @@
:keystore - the keystore to use for SSL connections
:key-password - the password to the keystore
:truststore - a truststore to use for SSL connections
- :trust-password - the password to the truststore"
+ :trust-password - the password to the truststore
+ :max-threads - the maximum number of threads to use (default 250)"
[handler options]
(let [^Server s (create-server (dissoc options :configurator))]
(when-let [configurator (:configurator options)]
(configurator s))
(doto s
(.addHandler (proxy-handler handler))
+ (.setThreadPool (QueuedThreadPool. (options :max-threads 250)))
(.start))
(when (:join? options true)
(.join s))

0 comments on commit 9adf1e6

Please sign in to comment.