I'm struggling to figure out why the @Asynchronous method in my EJB is not actually being called asynchronously. I am working on JBoss AS 7 using CDI (with beans.xml) in a JSF2 project with simple .war packaging created by Maven.
EJB is packaged in .war along with managed JSF2 beans, which interacts with it. This is a simple @Stateless EJB. He used it by injecting it (via @Inject) into a JSF2-controlled bean that calls its @Asynchronous method.
Instead of calling the @Asynchronous method that returns the Future immediately, it runs synchronously, as if it were a regular direct call. This is true if I use a local view without an interface or a local business interface to invoke EJB.
Is @Asynchronous supported only for @Remote beans? If so, can it work inside a .war package, or do I need to pack an EJB jar in an EAR just to get this feature?
Simplified code, such as sake, with each class in the same package in .war:
public interface SomeEJB { public Future<Void> doSomething(); } @Stateless @Local(SomeEJB.class) public class SomeEJBImpl implements SomeEJB { @Asynchronous @Override public Future<Void> doSomething() {
Craig Ringer
source share