Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <h2>What solved it for me (a Spring, not Jetty issue)</h2> <p>I was wrong when I wrote this in the question:</p> <blockquote> <p>It looks like Jetty by default uses just one thread.</p> </blockquote> <p>This turned out to be purely a Spring issue. In applicationContext.xml, I changed</p> <pre><code>&lt;task:annotation-driven/&gt; </code></pre> <p>into</p> <pre><code>&lt;task:annotation-driven scheduler="scheduler-pool"/&gt; &lt;task:scheduler id="scheduler-pool" pool-size="5"/&gt; </code></pre> <p>... and different <code>@Scheduled</code> tasks now happily run in separate threads like <code>scheduler-pool-1</code> or <code>scheduler-pool-3</code>.</p> <h2>How to tweak Jetty threadpool configs (with jetty-runner)</h2> <p><sup>(Before I realised my problem was <em>not</em> a Jetty issue, I had already looked into how Jetty threadpools are configured. Documenting that here; maybe it is useful to someone.)</sup></p> <p>Create a <a href="http://wiki.eclipse.org/Jetty/Reference/jetty.xml"><code>jetty.xml</code> config file</a> (somewhere like <code>src/main/resources</code> so that it gets copied to the compilation target dir), and customise it to your liking. </p> <p>Example (probably a poor one):</p> <pre><code>&lt;?xml version="1.0"?&gt; &lt;!-- For some reason, must use org.eclipse classes, even though we depend on org.mortbay Jetty... --&gt; &lt;Configure id="Server" class="org.eclipse.jetty.server.Server"&gt; &lt;Set name="ThreadPool"&gt; &lt;New class="org.eclipse.jetty.util.thread.QueuedThreadPool"&gt; &lt;Set name="minThreads"&gt;3&lt;/Set&gt; &lt;Set name="maxThreads"&gt;5&lt;/Set&gt; &lt;/New&gt; &lt;/Set&gt; &lt;/Configure&gt; </code></pre> <p>Then, tell jetty-runner to use that config file with the <code>--config</code> switch. So for example in Heroku's <code>Procfile</code>, add <code>--config target/classes/jetty.xml</code>:</p> <pre><code>web: java $JAVA_OPTS -jar target/dependency/jetty-runner.jar --config target/classes/jetty.xml --port $PORT target/*.war </code></pre> <hr> <p>If you also happen to be using <strong>jetty-maven-plugin</strong>, you can tell it to use your custom Jetty config by adding this under <code>&lt;configuration&gt;</code> in <code>pom.xml</code>:</p> <pre><code>&lt;jettyConfig&gt;target/classes/jetty.xml&lt;/jettyConfig&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload