jsr339-experts@jax-rs-spec.java.net

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

From: Bill Burke <bburke_at_redhat.com>
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