EJB @Asynchronous在同一个类中不起作用 [英] EJB @Asynchronous does not work in same class

查看:202
本文介绍了EJB @Asynchronous在同一个类中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下情况:

我希望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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆