EJB @Asynchronous不在同一类工作 [英] EJB @Asynchronous does not work in same class

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

问题描述

我有以下情况:

我希望的methodB被执行10次并联。但它只能发生在的methodB是从另一个bean调用。

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可以公开使用异步方法客户端调用语义

A session bean can expose methods with asynchronous client invocation semantics

...

该@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天全站免登陆