[jboss-cvs] JBossAS SVN: r58992 - trunk/ejb3/src/main/org/jboss/ejb3

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Dec 12 05:50:27 EST 2006


Author: dimitris at jboss.org
Date: 2006-12-12 05:50:24 -0500 (Tue, 12 Dec 2006)
New Revision: 58992

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

Modified: trunk/ejb3/src/main/org/jboss/ejb3/BaseSessionContext.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb3/BaseSessionContext.java	2006-12-12 10:49:08 UTC (rev 58991)
+++ trunk/ejb3/src/main/org/jboss/ejb3/BaseSessionContext.java	2006-12-12 10:50:24 UTC (rev 58992)
@@ -1,24 +1,24 @@
 /*
-  * JBoss, Home of Professional Open Source
-  * Copyright 2005, JBoss Inc., and individual contributors as indicated
-  * by the @authors tag. See the copyright.txt in the distribution for a
-  * full listing of individual contributors.
-  *
-  * This is free software; you can redistribute it and/or modify it
-  * under the terms of the GNU Lesser General Public License as
-  * published by the Free Software Foundation; either version 2.1 of
-  * the License, or (at your option) any later version.
-  *
-  * This software is distributed in the hope that it will be useful,
-  * but WITHOUT ANY WARRANTY; without even the implied warranty of
-  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-  * Lesser General Public License for more details.
-  *
-  * You should have received a copy of the GNU Lesser General Public
-  * License along with this software; if not, write to the Free
-  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-  */
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
 package org.jboss.ejb3;
 
 import java.io.Externalizable;
@@ -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