问题
With JBoss/Wildfly one is able to use the @TransactionTimeout
proprietary annotation and define a transaction timeout for a specific Session Bean.
What is the equivalent way of doing it using IBM WebSphere?
We are using EJB Timer and one of the Beans will over an hour to complete.
Sample code for Wildfly:
import org.jboss.ejb3.annotation.TransactionTimeout;
@Stateless
@TransactionTimeout(value=7200)
public class TimerBean {
}
Note: Using WebSphere 8.5. Modifying the global transaction time is not an option, we need to do it for a specific Session Bean, or maybe an Application (EAR).
回答1:
Yes, it is possible. You can set it via transaction-time-out
in custom extension ibm-ejb-jar-ext.xml
file.
In that file define:
<session name="TimerBean">
<global-transaction transaction-time-out="7200"/>
</session>
Component Transaction Timeout
For enterprise beans that use container-managed transactions only, specifies the transaction timeout, in seconds, for any new global transaction that the container starts on behalf of the enterprise bean. For transactions started on behalf of the component, the Component Transaction Timeout setting overrides the default total transaction lifetime timeout that is configured in the transaction service settings for the application server.
For more details check Configuring transactional deployment attributes
来源:https://stackoverflow.com/questions/28094890/bean-transaction-timeout-in-websphere-using-ejb-timer