-
1. Re: POJO transaction timeout
admin.admin.email.tld Jul 4, 2008 5:52 PM (in response to damianharvey.damianharvey.gmail.com)This wiki is unfortunately outdated (somewhat typical of JBoss), but is useful:
http://wiki.jboss.org/wiki/TransactionTimeout
Also, you can use the annotation you mentioned above:
http://docs.jboss.com/ejb3/embedded/api/org/jboss/annotation/ejb/TransactionTimeout.html
And refer to Mike Keith's book on EJB3/JPA for coverage on the UserTransaction interface, there is a setTransactionTimeout() method that may be useful unless you want to set it globally.
You may also be able to process the DB transaction(s) asynchronously, but not sure that will help in your use case or not...
Also, you can turn off transaction support
(transaction type = @NOT_SUPPORTED)
for those methods, if that works for you... -
2. Re: POJO transaction timeout
damianharvey.damianharvey.gmail.com Jul 4, 2008 6:25 PM (in response to damianharvey.damianharvey.gmail.com)Thanks Arbi. I've seen those links.
After reading the API it looks like I can turn off transaction support for a POJO method like this:
@Transactional(TransactionPropagationType.NEVER)
Even so, in the ideal world I would be able to do something like this:
@Transactional(TransactionPropagationType.REQUIRED, timeout = 600)
Cheers,
Damian.
-
3. Re: POJO transaction timeout
svadu Jul 4, 2008 11:21 PM (in response to damianharvey.damianharvey.gmail.com)Good find!
-
4. Re: POJO transaction timeout
samdoyle Jan 15, 2009 11:40 PM (in response to damianharvey.damianharvey.gmail.com)It does not look as if the @TransactionTimeout works on non-EJB3 POJOS
From the api:
Annotation for specifying the transaction timeout of an EJB business method
I have cases where even using this annotation on a POJO will result on a timeout less then the time I specify. Is there an alternate way of doing this in Seam?
Thanks in advance.
-
5. Re: POJO transaction timeout
jkronegg Aug 20, 2009 3:16 PM (in response to damianharvey.damianharvey.gmail.com)On a project using JTA transactions and POJO entities (no EJB3), we use the following solution:
@Transactional public void myLongRunningMethod() { // set the transaction timeout try { int transactionTimeoutSeconds = 1000; log.info("setting transaction timeout to "+transactionTimeoutSeconds+" seconds"); ((javax.transaction.UserTransaction)org.jboss.seam.transaction.Transaction.instance()).setTransactionTimeout(transactionTimeoutSeconds); } catch (SystemException e1) { // failed to set the transaction timeout => just log some content e1.printStackTrace(); } // my long running code ... }
-
6. Re: POJO transaction timeout
seanbizzo Nov 9, 2010 12:14 PM (in response to damianharvey.damianharvey.gmail.com)JBOSS 5.1.0
SEAM 2.2.0configure the timeout for your CMT in /default/deploy/transaction-jboss-beans.xml the default is 5 minutes (300 seconds)
<property name="transactionTimeout">300</property>
increase the duration to whatever length of time you
think
it should take.regular pojo with asynchronous method call, not ejb just seam component
@Asynchronous @Transactional(TransactionPropagationType.REQUIRED) public void doSomethingAsynchronously(List<Object> list) { //do long running thing here on list }
this works for us on a large set of records like a mini batch process.