title: Spring MVC - @Controller annotation and processing concurrent requests
body: <p>I am using pieces of the Spring MVC framework; in particular, I am making use of the @Controller, @RequestMapping and @ResponseBody annotations, in conjunction with a webstatsHttpMessageConverter hooked up to an OXM jaxb2 marshaller bean. My controller methods use the @RequestParam annotations to parse some GET parameters, query a service that uses a JPA EntityManager behind the scenes, and returns a JAXB object that is converted to its XML representation by the HttpMessageConverter.</p>
  
  <p>I pared this scenario down to a very simple test case to try and determine the location of an execution delay that I have noticed; Example controller method:</p>
  
  <pre><code>    @RequestMapping("/my_service__method_endpoint")
      @ResponseBody
   public Jaxb2CompiledClass getSomeData(@RequestParam String param1,
                           @RequestParam Date start, @RequestParam Date end) {
              log.debug("Entering getSomeData");
              Thread.sleep(5000);
              log.debug("Finished waiting, leaving getSomeData);
  
    return new Jaxb2CompiledClass();
   }
  </code></pre>
  
  <p>This scenario works fine, and returns the appropriate data in the appropriate format. However, while load testing this configuration, I've run into a problem - each of my controller methods annotated with @RequestMapping will not run concurrently; if I spawn multiple HTTP requests to the service endpoint, each method call will finish before the next HTTP request is processed. In my actual code, I am using service objects to pull results via JPA and transform those results into an object of the appropriate Jaxb2 class. My understanding is that this controller should be able to run these methods concurrently, one for each HTTP request invoking the /my_service__method_endpoint. Is there some fundamental concept I am missing out on here? The log output from the code above shows that each call to getSomeData is waiting for the previous invocation to complete running before kicking off. This is obviously highly undesirable in a high-volume environment.</p>