Author: norman.richards(a)jboss.com
Date: 2009-08-13 13:24:13 -0400 (Thu, 13 Aug 2009)
New Revision: 11377
Modified:
branches/community/Seam_2_2/src/main/org/jboss/seam/util/Work.java
Log:
JBSEAM-4340
Modified: branches/community/Seam_2_2/src/main/org/jboss/seam/util/Work.java
===================================================================
--- branches/community/Seam_2_2/src/main/org/jboss/seam/util/Work.java 2009-08-13 13:26:01
UTC (rev 11376)
+++ branches/community/Seam_2_2/src/main/org/jboss/seam/util/Work.java 2009-08-13 17:24:13
UTC (rev 11377)
@@ -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
{
Show replies by date