Created
February 17, 2017 17:20
-
-
Save Velrok/4e7f475ec19c1c67ecbd1a6e23830371 to your computer and use it in GitHub Desktop.
Inject a different factory function that creates a fixed sized request queue.
This file contains hidden or 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
(def jetty-req-q (java.util.concurrent.ArrayBlockingQueue. configuration/http-queue-length)) | |
(defn create-threadpool [options] | |
(let [pool (org.eclipse.jetty.util.thread.QueuedThreadPool. (options :max-threads configuration/http-max-threads) | |
(options :min-threads configuration/http-min-threads) | |
0 | |
jetty-req-q)] | |
(.setMinThreads pool (options :min-threads configuration/http-min-threads)) | |
(when (:daemon? options false) | |
(.setDaemon pool true)) | |
pool)) | |
(alter-var-root #'ring.adapter.jetty/create-threadpool | |
(constantly create-threadpool)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment