Creating Asynchronous Methods in EJB 3.1
By cindo on Sep 18, 2012
OBE of the Month: Creating Asynchronous Methods
This OBE covers creating an EJB 3.1 application that demonstrates the use of the @Asynchronous annotation in an Enterprise Java Bean (EJB) class or specific method.
In this tutorial, you will create a Java EE 6 Web Application and add the following components to it - a Stateless Session Bean with two asynchronous methods. You define a Servlet to call the asynchronous methods and to keep track of the invocation and completion times to demonstrate the asynchronous nature of the method calls. The index.jsp will contain a form with a submit button, Run allowing you to execute the application. The form will submit to the Servlet which invokes the asynchronous methods defined in the session bean and the response is re-directed to response.jsp. Information about the asynchronous handling procedure is displayed to users. From this information, users will notice that the invoker thread and the called asynchronous thread are working concurrently.
Related OBE’s that might interest you: