nobody Have a Question?HelpLogin
  • Home
  • Content Details

Creating Asynchronous Methods in EJB 3.1

Would you recommend this content?
1 user(s) recommend this content
  • This example demonstrates the use of the EJB 3.1 @Asynchronous annotation in an EJB class or specific method.  In EJB 3.1, session beans support asynchronous method invocations. Bean methods annotated with @Asynchronous are invoked asynchronously. When a client invokes methods with the @Asynchronous annotation, the container immediately returns control to the client and invokes the method in a different thread. The method may return a future object to allow the client to check on the status of the method invocation, and retrieve result values that are asynchronously produced. EJB 3.1 supports this feature by using Future, which is part of standard java concurrency. Future represents the result of an asynchronous computation.

  • 06-Sep-12
  • 45 minutes
  • Anjana Shenoy
  • EJB 3.1 New Features Series

Please Log In to Bookmark this OBE

Bookmarked 3 times

1 user(s) recommend this content

Hide/Show Reviews

krzysztof.korzeniewski 4 months ago
The purpose/reason of AsyncResult remains unrevealed. Also the reason for StringBuilder in the Bean is kept a secret unit Servlet is created. And lastly, the calculation parameters could be provided in index.jsp form, instead being harcoded in Servlet. Nevertheless, good enough to understand the concept of @Asynchronous.
  • Thanks very much for your feedback. If a aynchronous method has a return value, the method has to return an AsyncResult object which is an implementation of Future. anjana.shenoy 07-Jan-14
  • Login to add a reply

Hide/Show Related OU Courses

Hide/Show Additional Resources

Information about Related Products