java - 使用 EJB 计时器的 WebSphere 中的 Bean 事务超时

标签 java jakarta-ee timeout websphere ejb-3.0

通过 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.

更多详情请查看Configuring transactional deployment attributes

关于java - 使用 EJB 计时器的 WebSphere 中的 Bean 事务超时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28094890/

相关文章:

java - 如何在 Oracle 中全局(或按 session )限制结果集?

java - 如何设置队列生产者超时?

java - JSON 到 Java 对象 - 无法识别的字段,未标记为可忽略

java - 如何使用Prepared Statement进行交易?

java - 避免对属性文件路径规范进行硬编码

jakarta-ee - 在所有 war 中共享 javax.ejb.Singleton

java - 何时以及为何使用 EclipseLink 缓存?

netbeans - Netbeans 中的 JavaEE 在部署时出现 BUILD FAILED 错误

spring - 避免长时间运行的报告生成过程超时

python - PyMongo max_time_ms