JBoss Community

What makes a business method asynchronous?

created by jaikiran pai in EJB 3.0 Development - View the full discussion

... other than the use of @Asynchronous annotation or it's xml equivalent. From what I see in the EJB3.1 Spec, Section 4.5.1:

 

The @Asynchronous annotation is used to designate which business methods are asynchronous.

...
Asynchronous methods can also be designated via the deployment descriptor.

 

 

I do however see that in our async interceptor (which has to decide whether to spawn a new thread or continue in the current one), we additionally check for method return type to decide whether it's asynchronous:

 

// Determine if asynchronous (either returns Future or has @Asynchronous)
      if (invocation.resolveAnnotation(Asynchronous.class) != null || actualMethod.getReturnType().equals(Future.class))

 

 

Just wondering whether this is OK. The only side-effect that I can think of, with this implicit rule for asynchronous method, is the difference in transaction semantics for that method invocation.

Reply to this message by going to Community

Start a new discussion in EJB 3.0 Development at Community