Hi Jaikiran,
I tested a simple asynchronous EJB under Jboss AS 7.0.2.Final Arc, and it does not work (the asynchronous method waits for 5 seconds synchronously):
20:36:16,815 INFO [stdout] (http--127.0.0.1-8080-1) request: begin Wed Nov 16 20:36:16 CET 2011
20:36:16,831 INFO [stdout] (http--127.0.0.1-8080-1) doAsyncStuff: begin Wed Nov 16 20:36:16 CET 2011
20:36:21,832 INFO [stdout] (http--127.0.0.1-8080-1) doAsyncStuff: end Wed Nov 16 20:36:21 CET 2011
20:36:21,834 INFO [stdout] (http--127.0.0.1-8080-1) request: end Wed Nov 16 20:36:21 CET 2011
My EJB is :
@Stateless
public class MyAsyncService {
@Asynchronous
public void doAsyncStuff() {
System.out.println("doAsyncStuff: begin "+ new Date());
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
System.out.println("doAsyncStuff: interrupted");
}
System.out.println("doAsyncStuff: end "+ new Date());
}
}
My servlet is :
@WebServlet("/MyServlet")
public class MyServlet extends HttpServlet {
@EJB
MyAsyncService myAsyncService;
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
System.out.println("request: begin "+new Date());
myAsyncService.doAsyncStuff();
System.out.println("request: end "+new Date());
}
}
Is this code supposed to work under 7.0.2?