[EJB 3.0 Development] - What makes a business method asynchronous?
by jaikiran pai
jaikiran pai [http://community.jboss.org/people/jaikiran] created the discussion
"What makes a business method asynchronous?"
To view the discussion, visit: http://community.jboss.org/message/552992#552992
--------------------------------------------------------------
... 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
[http://community.jboss.org/message/552992#552992]
Start a new discussion in EJB 3.0 Development at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
14 years, 3 months