I wrote a small test to understand asynchronous behavior in EJB3.1 using the @Asynchronous
annotation. It seems that:
If the method exists in the same bean as the caller,
- The call is no longer synchronized.
- Caller operation is marked for rollback if the transaction in the asynchronous method is rolled back; probably a side effect 1.
However, if the asynchronous method exists in another bean, it is expected that the behavior will be asynchronous and the caller's transaction will be independent (the async method has the REQUIRES_NEW behavior for the transaction). This puzzles me, because in both cases the behavior is not the same. Someone please clarify?
PS Environment EJB 3.1, JBoss 6
source share