[prev in list] [next in list] [prev in thread] [next in thread]
List: jboss-cvs-commits
Subject: [jboss-cvs] jboss/src/main/org/jboss/ejb/plugins ...
From: Adrian Brock <adrian.brock () jboss ! com>
Date: 2005-08-31 21:51:12
Message-ID: E1EAaUC-0008DW-JF () committer01 ! frg ! pub ! inap ! atl ! jboss ! com
[Download RAW message or body]
User: adrian
Date: 05/08/31 17:51:12
Modified: src/main/org/jboss/ejb/plugins Tag: Branch_4_0
AbstractTxInterceptor.java
AbstractTxInterceptorBMT.java
Log:
[JBAS-2128] - Recover from a bad BMT SFSB user transaction
Revision Changes Path
No revision
No revision
1.22.6.1 +17 -2 \
jboss/src/main/org/jboss/ejb/plugins/AbstractTxInterceptor.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: AbstractTxInterceptor.java
===================================================================
RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/AbstractTxInterceptor.java,v
retrieving revision 1.22
retrieving revision 1.22.6.1
diff -u -b -r1.22 -r1.22.6.1
--- AbstractTxInterceptor.java 15 Apr 2004 14:30:29 -0000 1.22
+++ AbstractTxInterceptor.java 31 Aug 2005 21:51:12 -0000 1.22.6.1
@@ -30,6 +30,7 @@
import org.jboss.invocation.Invocation;
import org.jboss.invocation.InvocationType;
+import org.jboss.tm.TxUtils;
/**
* A common superclass for the transaction interceptors.
@@ -42,7 +43,7 @@
*
* @author <a href="mailto:osh@sparre.dk">Ole Husgaard</a>
* @author <a href="mailto:dain@daingroup.com">Dain Sundstrom</a>
- * @version $Revision: 1.22 $
+ * @version $Revision: 1.22.6.1 $
*/
abstract class AbstractTxInterceptor
extends AbstractInterceptor
@@ -120,6 +121,20 @@
// attempt to rollback the transaction
Transaction tx = invocation.getTransaction();
+ if (tx == null)
+ {
+ // Look for a hanging active user transaction that we should mark \
rollback + try
+ {
+ tx = tm.getTransaction();
+ if (TxUtils.isActive(tx) == false)
+ tx = null;
+ }
+ catch (Exception ex)
+ {
+ log.warn("Unable to determine transaction context", ex);
+ }
+ }
if (tx != null)
{
try
1.13.6.2 +37 -1 \
jboss/src/main/org/jboss/ejb/plugins/AbstractTxInterceptorBMT.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: AbstractTxInterceptorBMT.java
===================================================================
RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/AbstractTxInterceptorBMT.java,v
retrieving revision 1.13.6.1
retrieving revision 1.13.6.2
diff -u -b -r1.13.6.1 -r1.13.6.2
--- AbstractTxInterceptorBMT.java 31 Aug 2005 19:29:48 -0000 1.13.6.1
+++ AbstractTxInterceptorBMT.java 31 Aug 2005 21:51:12 -0000 1.13.6.2
@@ -24,12 +24,13 @@
import org.jboss.ejb.EnterpriseContext;
import org.jboss.ejb.AllowedOperationsAssociation;
import org.jboss.invocation.Invocation;
+import org.jboss.tm.TxUtils;
/**
* A common superclass for the BMT transaction interceptors.
*
* @author <a href="mailto:osh@sparre.dk">Ole Husgaard</a>
- * @version $Revision: 1.13.6.1 $
+ * @version $Revision: 1.13.6.2 $
*/
abstract class AbstractTxInterceptorBMT extends AbstractTxInterceptor
{
@@ -162,6 +163,8 @@
{
if (stateless)
checkStatelessDone();
+ else
+ checkBadStateful();
}
finally
{
@@ -223,6 +226,39 @@
}
}
+ private void checkBadStateful() throws RemoteException
+ {
+ int status = Status.STATUS_NO_TRANSACTION;
+
+ try
+ {
+ status = tm.getStatus();
+ }
+ catch (SystemException ex)
+ {
+ log.error("Failed to get status", ex);
+ }
+
+ switch (status)
+ {
+ case Status.STATUS_COMMITTING :
+ case Status.STATUS_MARKED_ROLLBACK :
+ case Status.STATUS_PREPARING :
+ case Status.STATUS_ROLLING_BACK :
+ try
+ {
+ tm.rollback();
+ }
+ catch (Exception ex)
+ {
+ log.error("Failed to rollback", ex);
+ }
+ String msg = "BMT stateful bean '" + \
container.getBeanMetaData().getEjbName() + + "' did not complete \
user transaction properly status=" + TxUtils.getStatusAsString(status); + \
log.error(msg); + }
+ }
+
// Inner classes -------------------------------------------------
public static class UserTxFactory implements ObjectFactory
-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
jboss-cvs-commits mailing list
jboss-cvs-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-cvs-commits
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic