users@glassfish.java.net

Re: EJB _at_Asynchronous method is invoked synchronously when called within the same class

From: Marina Vatkina <marina.vatkina_at_oracle.com>
Date: Fri, 06 Aug 2010 08:49:39 -0700

Theo,

Container is not involved if you call the method directly. You need to
call it on
http://download.oracle.com/javaee/6/api/javax/ejb/SessionContext.html#getBusinessObject(java.lang.Class)
ref.

-marina

Theodor Richard wrote:
> Hello folks,
>
> I have the following stateless session bean:
>
> @Stateless
> @LocalBean
> public class Bean {
> @Asynchronous
> public void methodA(){
> // do something...
> }
>
> @Timeout
> public void methodB(Timer timer) {
> methodA();
> }
> }
>
> When I call methodA from outside the bean, it is invoked
> asynchronously (as expected). However, when methodA is called from
> methodB, it is invoked synchronously. Any explanation for that? I
> couldn't find anything @Asynchronous section of the spec.
>
> Thanks,
> Theo