Change EJB Transaction Timeout

This section describes how the EJB transaction timeout of a specific EJB class can be changed.

 

What does this section cover?

WebSphere Application Server

In order for the transaction timeout to change for a specific EJB class, the EJB class along with the new transaction timeout must be specified in ibm-ejb-jar-ext.xml which is located in your custom project's directory under src/ejbModule/META-INF

 Example

<time-out>: Declares the number of seconds between method invocations after which a stateful session bean will be no longer available.Requires value attribute, a positive integer. Only applicable to stateful session beans. Attribute default: 300. 

<global-transaction>: Declares the transaction timeout (in seconds) to be used on transactions started by this specific EJB type, overriding the server setting for global transaction timeout. Attribute default: Server transaction timeout setting for transaction-time-out.

ibm-ejb-jar-ext.xml
<ejb-jar-ext>
	<session name="CUSTOMCRMProcessRentalBean">
		<global-transaction transaction-time-out="86400" />
		<time-out value="86400" />
	</session>
	...
</ejb-jar-ext>

Wildfly Application Server

In order for the transaction timeout to change for a specific EJB class, the EJB class along with the new transaction timeout must be specified in jboss-ejb3.xml which is located in your custom project's directory under src/ejbModule/META-INF

 Example
jboss-ejb3.xml
<jboss:ejb-jar>
	<enterprise-beans>
		<session>
			<ejb-name>CUSTOMCRMProcessRentalBean</ejb-name>
			<ejb-class>com.crm.process.rentals.CUSTOMCRMProcessRentalBean</ejb-class>
			<session-type>Stateless</session-type>
		</session>
		...
	</enterprise-beans>
	<assembly-descriptor>
		<container-transaction>
    		<method>
           		<ejb-name>CUSTOMCRMProcessRentalBean</ejb-name>
            	<method-name>*</method-name>
        		<method-intf>Local</method-intf>
        	</method>
			<tx:trans-timeout>
            	<tx:timeout>86400</tx:timeout>
        		<tx:unit>Seconds</tx:unit>
    		</tx:trans-timeout>
		</container-transaction>
		...
	</assembly-descriptor>
</jboss:ejb-jar>