【发布时间】:2016-01-06 10:55:01
【问题描述】:
在 Glassfish 中,EJB 事务超时默认设置为 120 秒,我想更改此值。
我知道可以通过在 glassfish-ejb-jar.xml 中定义“cmt-timeout-in-seconds”参数来更改它,但是我使用带有 EJB 类的 Web 模块,并使用 glassfish-web.xml分别。
有什么办法可以改变超时时间吗?
统一更新:
事务服务设置中的事务超时值无效。
@Schedule(minute = "*/5", hour = "*", persistent = false)
public void doSomething() {
log.info("Started");
try {
Thread.sleep(1000 * 119);
} catch (InterruptedException ex) {
log.info("Interrupted", ex);
}
log.info("Finished");
}
上面的代码运行良好。但是如果把休眠时间改为121秒
Thread.sleep(1000 * 121);
在 GF 服务器日志中我看到一个错误:
Warning: EJB5123:Rolling back timed out transaction
此后,服务再次调用 doSomething() 方法,2 分钟后我再次看到错误:
Warning: EJB5123: Rolling back timed out transaction
Info: EJB5119:Expunging timer [...] after [2] failed deliveries
并且服务不再调用 doSomething() 方法。
【问题讨论】:
标签: jakarta-ee ejb glassfish-4.1.1