Skip to main content

[jsr339-experts] Spec's reference of EJB's @Asynchronous is incorrect

  • From: Bill Burke <bburke@...>
  • To: "jsr339-experts@..." <jsr339-experts@...>
  • Subject: [jsr339-experts] Spec's reference of EJB's @Asynchronous is incorrect
  • Date: Wed, 30 Jan 2013 10:21:01 -0500

EJB methods can only be async if they return 'void' or a Future.

In 'master' GIT, the spec, section 8.3 breaks the contract of how EJB and @Asynchronous works. @Asynchronous 'void' methods are *fire-and-forget* methods and HTTP is not a fire-and-forget protocol. IMNSHO, this example should be removed and JAX-RS use with EJB @Asynchronous should be illegal.

The only thing I could support is if you immediately returned 202, Accepted to the client and then continued on with the EJB invocation:

@Stateless
@Path("/root")
public class MyEjbResource {

   @POST
   @Asynchronous
   public void doit() {
      do a bunch of stuff
   }
}


Invocation on doit() would immediately return a 202 response to the client. This would of course require some pretty deep integration with the EJB container as you would have to process parameter injections and return 202 before you invoked the method. I would rather you just made it illegal to use @Asynchronous.
--
Bill Burke
JBoss, a division of Red Hat
http://bill.burkecentral.com


[jsr339-experts] Spec's reference of EJB's @Asynchronous is incorrect

Bill Burke 01/30/2013

[jsr339-experts] Re: [jax-rs-spec users] Spec's reference of EJB's @Asynchronous is incorrect

Marek Potociar 01/30/2013

[jsr339-experts] Re: [jax-rs-spec users] Spec's reference of EJB's @Asynchronous is incorrect

Bill Burke 01/30/2013

[jsr339-experts] Re: [jax-rs-spec users] Spec's reference of EJB's @Asynchronous is incorrect

Jan Algermissen 01/30/2013

[jsr339-experts] Re: [jax-rs-spec users] Re: Spec's reference of EJB's @Asynchronous is incorrect

Santiago Pericas-Geertsen 01/31/2013

[jsr339-experts] Re: [jax-rs-spec users] Re: Spec's reference of EJB's @Asynchronous is incorrect

Marek Potociar 01/30/2013
 
 
Close
loading
Please Confirm
Close