EJB - Transaction Time out

2019-07-29 04:49发布

How can we define method level transaction timeout in Session EJB (Container Managed Transaction) in JBOSS 4 container?

2条回答
再贱就再见
2楼-- · 2019-07-29 05:36
兄弟一词,经得起流年.
3楼-- · 2019-07-29 05:52

This is excerpt from JBoss Wiki which specifies exactly this:

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>
查看更多
登录 后发表回答