Julien Kronegg [
http://community.jboss.org/people/jkronegg] created the discussion
"Re: @Asynchronous EJB 3.1 AS7"
To view the discussion, visit:
http://community.jboss.org/message/636852#636852
--------------------------------------------------------------
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?
--------------------------------------------------------------
Reply to this message by going to Community
[
http://community.jboss.org/message/636852#636852]
Start a new discussion in JBoss AS 7 Development at Community
[
http://community.jboss.org/choose-container!input.jspa?contentType=1&...]