By reza_rahman on Sep 12, 2013
As many of you might already be aware, one of the key changes in Servlet 3/Java EE 6 was the introduction of asynchronous Servlets. Interestingly enough, a lot of the code examples at the time used native Java SE concurrency APIs to demonstrate the asynchronous Servlets feature. The problem in a Java EE environment is that Java SE concurrency essentially bypasses the Java EE runtime altogether and misses valuable contextual information (security, class-loader, naming, etc), not to mention potentially compromising stability/scalability since it sidesteps the container's internal thread/resource pools. Native Java SE threads also can't be managed or monitored via the application server (such as providing admin console visualizations, automatic timeouts, long-running warnings, etc). This of course is where the Java EE concurrency utilities standardized in Java EE 7 comes in. In a recent code-driven blog post, Shing Wai Chan demonstrates how to properly use asynchronous Servlets via the Java EE concurrency utilities.
For those that aren't big fans of lower level concurrency APIs (I sympathize :-)), it is certainly possible to use asynchronous Servlets with EJB 3 @Asynchronous instead as demonstrated here.