|
177 | 177 | (.setAllowNullPathInfo true)
|
178 | 178 | (JettyWebSocketServletContainerInitializer/configure nil)))
|
179 | 179 |
|
180 |
| -(defn- server-connector ^ServerConnector [^Server server & factories] |
181 |
| - (ServerConnector. server #^"[Lorg.eclipse.jetty.server.ConnectionFactory;" |
182 |
| - (into-array ConnectionFactory factories))) |
| 180 | +(defn- server-connector ^ServerConnector [^Server server factories options] |
| 181 | + (let [acceptors (options :acceptor-threads -1) |
| 182 | + selectors (options :selector-threads -1)] |
| 183 | + (ServerConnector. server (int acceptors) (int selectors) |
| 184 | + ^"[Lorg.eclipse.jetty.server.ConnectionFactory;" |
| 185 | + (into-array ConnectionFactory factories)))) |
183 | 186 |
|
184 | 187 | (defn- unix-domain-server-connector ^UnixDomainServerConnector
|
185 |
| - [^Server server & factories] |
186 |
| - (UnixDomainServerConnector. server #^"[Lorg.eclipse.jetty.server.ConnectionFactory;" |
187 |
| - (into-array ConnectionFactory factories))) |
| 188 | + [^Server server factories options] |
| 189 | + (let [acceptors (options :acceptor-threads -1) |
| 190 | + selectors (options :selector-threads -1)] |
| 191 | + (UnixDomainServerConnector. server (int acceptors) (int selectors) |
| 192 | + ^"[Lorg.eclipse.jetty.server.ConnectionFactory;" |
| 193 | + (into-array ConnectionFactory factories)))) |
188 | 194 |
|
189 | 195 | (defn- http-config ^HttpConfiguration [options]
|
190 | 196 | (doto (HttpConfiguration.)
|
|
196 | 202 |
|
197 | 203 | (defn- http-connector ^ServerConnector [server options]
|
198 | 204 | (let [http-factory (HttpConnectionFactory. (http-config options))]
|
199 |
| - (doto (server-connector server http-factory) |
| 205 | + (doto (server-connector server [http-factory] options) |
200 | 206 | (.setPort (options :port 80))
|
201 | 207 | (.setHost (options :host))
|
202 | 208 | (.setIdleTimeout (options :max-idle-time 200000)))))
|
|
248 | 254 | (when-let [scan-interval (options :keystore-scan-interval)]
|
249 | 255 | (.addBean server (doto (KeyStoreScanner. ssl-context)
|
250 | 256 | (.setScanInterval scan-interval))))
|
251 |
| - (doto (server-connector server ssl-factory http-factory) |
| 257 | + (doto (server-connector server [ssl-factory http-factory] options) |
252 | 258 | (.setPort ssl-port)
|
253 | 259 | (.setHost (options :host))
|
254 | 260 | (.setIdleTimeout (options :max-idle-time 200000)))))
|
|
257 | 263 | (let [http-factory (HttpConnectionFactory. (http-config options))
|
258 | 264 | socket (io/file (options :unix-socket))]
|
259 | 265 | (.deleteOnExit socket)
|
260 |
| - (doto (unix-domain-server-connector server http-factory) |
| 266 | + (doto (unix-domain-server-connector server [http-factory] options) |
261 | 267 | (.setUnixDomainPath (.toPath socket))
|
262 | 268 | (.setIdleTimeout (options :max-idle-time 200000)))))
|
263 | 269 |
|
|
328 | 334 | :thread-pool - custom thread pool instance for Jetty to use
|
329 | 335 | :truststore - a truststore to use for SSL connections
|
330 | 336 | :trust-password - the password to the truststore
|
| 337 | + :acceptor-threads - the number of acceptor threads to use |
| 338 | + :selector-threads - the number of selector threads to use |
331 | 339 | :max-threads - the maximum number of threads to use (default 50)
|
332 | 340 | :min-threads - the minimum number of threads to use (default 8)
|
333 | 341 | :max-queued-requests - the maximum number of requests to be queued
|
|
0 commit comments