The thread pool in Jetty by default is implemented with an unbounded queue once the thread pool fills up. I'd like to put a limit on the size of the queue. There is a constructor for BlockingArrayQueue that takes a maxCapacity value but I can see no way to call it using jetty.xml. As of Jetty 9, there is no setter for the threadpool in org.eclipse.jetty.server.Server, I can only get a reference to the thread pool that has already been instantiated and mutate it (see this answer). And the setter for the queue field in QueuedThreadPool throws an UnsupportedOperationException, saying to use constructor injection. But this is impossible if I can only mutate the thread pool, not set a new one on the server instance. Attempting to define the thread pool as a constructor arg yields the following warning:
2014-09-22 13:15:13.688:WARN:oejx.XmlConfiguration:main: Ignored arg: | 200501000| 6000| false|
This is with the Jetty Maven Plugin v9.2.2.v20140723. Here is the configuration in my pom.xml:
<configuration>
<jettyXml>${basedir}/jetty.xml</jettyXml>
<stopKey>x</stopKey>
<stopPort>7999</stopPort>
<requestLog implementation="org.eclipse.jetty.server.NCSARequestLog">
<append>true</append>
</requestLog>
<webApp>
<war>${basedir}/target/app</war>
<contextPath>/app</contextPath>
</webApp>
<scanTargets>
<scanTarget>${basedir}/src/main/webapp/WEB-INF/</scanTarget>
</scanTargets>
<reload>manual</reload>
</configuration>