[jboss-cvs] JBossAS SVN: r58990 - branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Dec 12 05:48:18 EST 2006


Author: dimitris at jboss.org
Date: 2006-12-12 05:48:15 -0500 (Tue, 12 Dec 2006)
New Revision: 58990

Modified:
   branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/BaseSessionContext.java
Log:
EJBTHREE-805, consider an asynchronous rollback due to timeout

Modified: branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/BaseSessionContext.java
===================================================================
--- branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/BaseSessionContext.java	2006-12-12 10:16:28 UTC (rev 58989)
+++ branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/BaseSessionContext.java	2006-12-12 10:48:15 UTC (rev 58990)
@@ -271,7 +271,8 @@
    {
       // EJB1.1 11.6.1: Must throw IllegalStateException if BMT
       TransactionManagementType type = TxUtil.getTransactionManagementType(((Advisor) getContainer()));
-      if (type != TransactionManagementType.CONTAINER) throw new IllegalStateException("Container " + getContainer().getEjbName() + ": it is illegal to call getRollbackOnly from BMT: " + type);
+      if (type != TransactionManagementType.CONTAINER)
+         throw new IllegalStateException("Container " + getContainer().getEjbName() + ": it is illegal to call getRollbackOnly from BMT: " + type);
 
       try
       {
@@ -280,13 +281,17 @@
          // The getRollbackOnly and setRollBackOnly method of the SessionContext interface should be used
          // only in the session bean methods that execute in the context of a transaction.
          if (tm.getTransaction() == null)
-            throw new IllegalStateException("setRollbackOnly() not allowed without a transaction.");
+            throw new IllegalStateException("getRollbackOnly() not allowed without a transaction.");
 
-         return tm.getStatus() == Status.STATUS_MARKED_ROLLBACK;
+         // EJBTHREE-805, consider an asynchronous rollback due to timeout
+         int status = tm.getStatus();
+         return status == Status.STATUS_MARKED_ROLLBACK
+             || status == Status.STATUS_ROLLING_BACK
+             || status == Status.STATUS_ROLLEDBACK;
       }
       catch (SystemException e)
       {
-         log.warn("failed to set rollback only; ignoring", e);
+         log.warn("failed to get tx manager status; ignoring", e);
          return true;
       }
    }




More information about the jboss-cvs-commits mailing list