TransactionTimeout annotation seems not to override global seetting on JBoss 5.x
Asked Answered
S

0

6

I have an EJB 3.0 based applicattion deployed on JBoss 5.1. The global value for transaction timeout configured at ${JBOSS_HOME}/server/default/deploy/transaction-jboss-beans.xml on property transactionTimeout is fine for most of our EJB methods. However, we have some methods whose duration is expected to be much longer than the value set there. We'd like to override the timeout specifically for those methods.

We've tried to do it as explained here, i.e. let the global value with a sensible value and then try to override specifically some methods via deployment descriptor at jboss.xml or via jboss specific annotations within the method.

The methods are within stateless session beans container managed. I've even forced those methods to create a new transaction as in some places is said that the annotation only works if the transaction is created in that moment.

../..
import org.jboss.ejb3.annotation.TransactionTimeout;
../..
    @Override
        @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
        @TransactionTimeout(900)
        public FileInfoObject setFileVariable(Desk desk, String variable, int maxBytes,
                String mimeAccepted, FileWithStream file)
                throws ParticipationFinishedException, PersistenceException {

../..
        }

The expected behavior is that for this method the timeout should be 900.

The actual behavior is quite fine and is the following:

  • if global timeout > method timeout then method timeout is applied
  • if global timeout <= method timeout then global timeout is applied

It seems that the applied timeout is the minimum of both which is a real problem if what we want is to extend the timeout for a specific method overriding the global value.

Any ideas? Am I missing something?

Seigler answered 26/9, 2012 at 9:27 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.