Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

EJB @Asynchronous does not work in same class

I've the following situation:

enter image description here

I wish the "methodB" was executed 10 times paralleling. But it only happening when the "methodB" is called from another bean.

Why the annotation "@Asynchronous" does not work when the method is called from another method in the same class?

Thanks.

like image 531
Rafael Orágio Avatar asked Aug 30 '12 14:08

Rafael Orágio


1 Answers

It only works for methods call via a client proxy, for example a @Local or @Remote interface. This is described in the EJB 3.1 specs (section 4.5 - 4.5.1):

A session bean can expose methods with asynchronous client invocation semantics

...

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

...

Asynchronous method invocation semantics only apply to the no-interface, Local business, and Remote business client views.

like image 186
dcernahoschi Avatar answered Nov 13 '22 05:11

dcernahoschi