EJB @Asynchronous在同一个类中不起作用 [英] EJB @Asynchronous does not work in same class
问题描述
我有以下情况:
我希望methodB被执行10次并行。但是只有当从另一个bean调用methodB时才会发生。
I wish the "methodB" was executed 10 times paralleling. But it only happening when the "methodB" is called from another bean.
为什么当方法从另一个方法调用时,@Asynchronous的注释不起作用相同的类?
Why the annotation "@Asynchronous" does not work when the method is called from another method in the same class?
谢谢。
推荐答案
通过客户端代理进行呼叫,例如 @Local
或 @Remote
界面。这在EJB 3.1规范(第4.5 - 4.5.1节)中有描述:
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):
会话bean可以使用异步客户端调用语义
...
@Asynchronous注释用于指定哪个业务方法是异步的。
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.
这篇关于EJB @Asynchronous在同一个类中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!