我们如何在 JBOSS 4 容器中的 session EJB(容器管理事务)中定义方法级事务超时?
最佳答案
这是摘自 JBoss Wiki正是这样指定的:
Per-method basis: Modifying the element inside the element of a session or entity bean. This is located in the META-INF/jboss.xml deployment descriptor of a session bean. When the transaction timeout is specified at the method level, it overrides the default timeout. Further information about this element can be found in jboss-x.x.x/docs/dtd/jboss_4_0.dtd. Example taken from the testsuite:
<?xml version="1.0"?>
<jboss>
<enterprise-beans>
<session>
<ejb-name>TxTimeout</ejb-name>
<jndi-name>jbosstest/tm/TxTimeout</jndi-name>
<exception-on-rollback>true</exception-on-rollback>
<method-attributes>
<method>
<method-name>testOverriddenTimeoutExpires</method-name>
<transaction-timeout>5</transaction-timeout>
</method>
<method>
<method-name>testOverriddenTimeoutDoesNotExpire</method-name>
<transaction-timeout>20</transaction-timeout>
</method>
</method-attributes>
</session>
</enterprise-beans>
</jboss>
关于java - EJB - 事务超时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5155874/