java - EJB - 事务超时

标签 java transactions jakarta-ee jboss ejb

我们如何在 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/

相关文章:

database - Codeigniter,事务中的错误跟踪

mongodb - mongodb无法在Go中执行事务,并且总是得到无法在多文档事务中创建 namespace

java - Eclipse 和 JBoss 不刷新或重建

java - IntelliJ想法: How to (by default) exclude a module from compilation which is broken and which is not part of the maven build?

java - 在Java中获取最大值sql

java - 如何在java中使用Cocos2d创建动画?

java - Spring 后处理器,顺序,@Required

java - 运行时派生类选择

java - Java Connection.close 是否回滚?

java - 调用过滤器的顺序是什么?