How to set EJB timeout period ?

EJBs support two types of transaction management: Container managed and Bean managed. Container managed transactions provide a transactional context for calls to bean methods, and are defined using Java annotations or the deployment descriptor file ejb-jar.xml. Bean managed transactions are controlled directly using the Java Transaction API (JTA) .

In both cases, you can set the Transaction Timeout for your EJBs using annotations or XML descriptors.

Check this tutorial to learn more about it: How to increase the Transaction Timeout in JBoss / WildFly

On the other hand, if you want to learn more about the JTA Transaction Timeout, we recommend the following reading: Configuring Transactions (JTA) using JBoss / Wildfly

JBoss AS 5

If you are using an older version of the application server, you can set the transaction timeout in the jboss-service.xml file ( available in the conf directory)

 
   <mbean code="com.arjuna.ats.jbossatx.jta.TransactionManagerService"
      name="jboss:service=TransactionManager">
      <attribute name="TransactionTimeout">300</attribute>
      <attribute name="ObjectStoreDir">${jboss.server.data.dir}/tx-object-store</attribute> 
   </mbean>

Modify the TransactionTimeout attribute as you need.

Note: The timeout attribute is in seconds not in milliseconds !

Found the article helpful? if so please follow us on Socials