title: Tomcat 7.0.32 +Spring MVC Servlet 3 Async is not working
body: <p>I wrote very simple controller which test Servlet 3 features:</p>
  
  <pre><code>@Autowired
      ThreadPoolTaskExecutor taskExecutor;
  
      @RequestMapping(value="{name}", method = RequestMethod.GET)
      public @ResponseBody DeferredResult&lt;MyResponse&gt; getShopInJSON(@PathVariable String name) {
  
          DeferredResult&lt;MyResponse&gt; df = new DeferredResult&lt;MyResponse&gt;();
          taskExecutor.submit(new MyRunnable(df));    
  
          return df; 
      }
  </code></pre>
  
  <p>In separate Thread I'm doing nothing but 5 second sleep command and after it I return <code>MyResult</code> POJO to <code>DeferredResult</code>.</p>
  
  <p>My web.xml file is according to Servlet 3 specifications:</p>
  
  <pre><code>&lt;web-app xmlns="http://java.sun.com/xml/ns/javaee"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
                               http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
           version="3.0"
           metadata-complete="true"&gt;
    &lt;display-name&gt;Archetype Created Web Application&lt;/display-name&gt;
      &lt;servlet&gt;
      &lt;async-supported&gt;true&lt;/async-supported&gt;
      &lt;servlet-name&gt;mvc-dispatcher&lt;/servlet-name&gt;
      &lt;servlet-class&gt;org.springframework.web.servlet.DispatcherServlet&lt;/servlet-class&gt;
      &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
    &lt;/servlet&gt;
    &lt;servlet-mapping&gt;
      &lt;servlet-name&gt;mvc-dispatcher&lt;/servlet-name&gt;
      &lt;url-pattern&gt;/&lt;/url-pattern&gt;
    &lt;/servlet-mapping&gt;
  &lt;/web-app&gt;
  </code></pre>
  
  <p>My Connector tomcat is the following:</p>
  
  <pre><code> &lt;Connector port="8080" protocol="HTTP/1.1"
                  maxThreads="5"
                  acceptCount="5"
                  connectionTimeout="20000"
                  redirectPort="8443" /&gt;
  </code></pre>
  
  <p>Now this is the interesting part. When running simple program which opens 10 concurrent connection I see that only 5 connections are served first and second 5 connections are served after first set is released (You can see it from time stemps). This is not how Servlet 3.0 should behave</p>
  
  <pre><code>Fri May 31 01:17:57 IDT 2013: Preparing 10 concurrent connections
  Fri May 31 01:18:02 IDT 2013: Output from Server int thread 9 :{"props1":"param1","props2":"param1"}
  Fri May 31 01:18:02 IDT 2013: Output from Server int thread 8 :{"props1":"param1","props2":"param1"}
  Fri May 31 01:18:02 IDT 2013: Output from Server int thread 4 :{"props1":"param1","props2":"param1"}
  Fri May 31 01:18:02 IDT 2013: Output from Server int thread 7 :{"props1":"param1","props2":"param1"}
  Fri May 31 01:18:02 IDT 2013: Output from Server int thread 2 :{"props1":"param1","props2":"param1"}
  Fri May 31 01:18:07 IDT 2013: Output from Server int thread 1 :{"props1":"param1","props2":"param1"}
  Fri May 31 01:18:07 IDT 2013: Output from Server int thread 0 :{"props1":"param1","props2":"param1"}
  Fri May 31 01:18:07 IDT 2013: Output from Server int thread 5 :{"props1":"param1","props2":"param1"}
  Fri May 31 01:18:07 IDT 2013: Output from Server int thread 6 :{"props1":"param1","props2":"param1"}
  Fri May 31 01:18:07 IDT 2013: Output from Server int thread 3 :{"props1":"param1","props2":"param1"}
  </code></pre>
  
  <p>If change Tomcat Connector to </p>
  
  <pre><code>   &lt;Connector connectionTimeout="200000" maxThreads="5" port="8080" protocol="org.apache.coyote.http11.Http11NioProtocol" redirectPort="8443"/&gt;
  </code></pre>
  
  <p>it works like charm. I don't want to do it. According to Tomcat docs I should receive Servlet 3.0 functionality without <code>Http11NioProtocol</code> connector. </p>
  
  <p>What is wrong?</p>