[seam-commits] Seam SVN: r11380 - branches/enterprise/JBPAPP_5_0/src/main/org/jboss/seam/util.
seam-commits at lists.jboss.org
seam-commits at lists.jboss.org
Thu Aug 13 17:48:05 EDT 2009
Author: manaRH
Date: 2009-08-13 17:48:05 -0400 (Thu, 13 Aug 2009)
New Revision: 11380
Modified:
branches/enterprise/JBPAPP_5_0/src/main/org/jboss/seam/util/Work.java
Log:
JBPAPP-2378
Modified: branches/enterprise/JBPAPP_5_0/src/main/org/jboss/seam/util/Work.java
===================================================================
--- branches/enterprise/JBPAPP_5_0/src/main/org/jboss/seam/util/Work.java 2009-08-13 21:47:15 UTC (rev 11379)
+++ branches/enterprise/JBPAPP_5_0/src/main/org/jboss/seam/util/Work.java 2009-08-13 21:48:05 UTC (rev 11380)
@@ -29,12 +29,26 @@
public final T workInTransaction() throws Exception
{
- org.jboss.seam.transaction.UserTransaction transaction = Transaction.instance();
+ org.jboss.seam.transaction.UserTransaction transaction = null;
+ boolean transactionActive = false;
+ boolean newTransactionRequired = false;
+ UserTransaction userTransaction = null;
- boolean transactionActive = transaction.isActiveOrMarkedRollback()
+ try {
+ transaction = Transaction.instance();
+
+ transactionActive = transaction.isActiveOrMarkedRollback()
|| transaction.isRolledBack(); //TODO: temp workaround, what should we really do in this case??
- boolean newTransactionRequired = isNewTransactionRequired(transactionActive);
- UserTransaction userTransaction = newTransactionRequired ? transaction : null;
+ newTransactionRequired = isNewTransactionRequired(transactionActive);
+ userTransaction = newTransactionRequired ? transaction : null;
+ } catch (IllegalStateException e) {
+ // for shutdown case, when we can't get the tx object because the event context is gone
+ // but we should still check if a tx is required and fail accordingly if it is
+ newTransactionRequired = isNewTransactionRequired(false);
+ if (newTransactionRequired) {
+ throw e;
+ }
+ }
try
{
More information about the seam-commits
mailing list