通过 JBoss/Wildfly,可以使用 @TransactionTimeout
专有注释并为特定 session Bean 定义事务超时。
使用 IBM WebSphere 的等效方法是什么?
我们正在使用 EJB Timer,其中一个 Bean 需要一个多小时才能完成。
Wildfly 示例代码:
import org.jboss.ejb3.annotation.TransactionTimeout;
@Stateless
@TransactionTimeout(value=7200)
public class TimerBean {
}
注意:使用 WebSphere 8.5。修改全局事务时间不是一个选项,我们需要为特定的 session Bean 或应用程序 (EAR) 执行此操作。
最佳答案
是的,这是可能的。您可以通过自定义扩展 ibm-ejb-jar-ext.xml
文件中的 transaction-time-out
进行设置。
在该文件中定义:
<session name="TimerBean">
<global-transaction transaction-time-out="7200"/>
</session>
Component Transaction Timeout
For enterprise beans that use container-managed transactions only, specifies the transaction timeout, in seconds, for any new global transaction that the container starts on behalf of the enterprise bean. For transactions started on behalf of the component, the Component Transaction Timeout setting overrides the default total transaction lifetime timeout that is configured in the transaction service settings for the application server.
关于java - 使用 EJB 计时器的 WebSphere 中的 Bean 事务超时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28094890/