[jboss-cvs] jboss-seam/src/main/org/jboss/seam/interceptors ...
Gavin King
gavin.king at jboss.com
Wed Nov 8 12:32:43 EST 2006
User: gavin
Date: 06/11/08 12:32:43
Modified: src/main/org/jboss/seam/interceptors
RollbackInterceptor.java
Log:
fix JBSEAM-456, don't hit UT from a container txn
Revision Changes Path
1.14 +5 -16 jboss-seam/src/main/org/jboss/seam/interceptors/RollbackInterceptor.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: RollbackInterceptor.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/interceptors/RollbackInterceptor.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -b -r1.13 -r1.14
--- RollbackInterceptor.java 1 Nov 2006 02:54:02 -0000 1.13
+++ RollbackInterceptor.java 8 Nov 2006 17:32:43 -0000 1.14
@@ -1,6 +1,7 @@
-//$Id: RollbackInterceptor.java,v 1.13 2006/11/01 02:54:02 gavin Exp $
+//$Id: RollbackInterceptor.java,v 1.14 2006/11/08 17:32:43 gavin Exp $
package org.jboss.seam.interceptors;
+import static org.jboss.seam.ComponentType.JAVA_BEAN;
import static org.jboss.seam.util.EJB.APPLICATION_EXCEPTION;
import static org.jboss.seam.util.EJB.rollback;
@@ -8,13 +9,11 @@
import java.util.Arrays;
import java.util.List;
-import org.jboss.seam.ComponentType;
import org.jboss.seam.annotations.AroundInvoke;
import org.jboss.seam.annotations.Interceptor;
import org.jboss.seam.annotations.Outcome;
import org.jboss.seam.annotations.Rollback;
import org.jboss.seam.intercept.InvocationContext;
-import org.jboss.seam.util.EJB;
import org.jboss.seam.util.Transactions;
/**
@@ -34,30 +33,20 @@
final Object result = invocation.proceed();
if ( isRollbackRequired( invocation.getMethod(), result ) )
{
- if ( getComponent().getType()==ComponentType.JAVA_BEAN )
- {
- //For JavaBeans, we assume the UT is accessible
- Transactions.setUserTransactionRollbackOnly();
- }
- else
- {
- //For session beans, we have to assume it might be
- //a CMT, so use the EJBContext
- EJB.getEJBContext().setRollbackOnly();
- }
+ Transactions.setTransactionRollbackOnly();
}
return result;
}
catch (Exception e)
{
//Reproduce the EJB3 rollback rules for JavaBean components
- if ( getComponent().getType()==ComponentType.JAVA_BEAN )
+ if ( getComponent().getType()==JAVA_BEAN )
{
if ( isRollbackRequired(e) )
{
try
{
- Transactions.setUserTransactionRollbackOnly();
+ Transactions.setTransactionRollbackOnly();
}
catch (Exception te) {} //swallow
}
More information about the jboss-cvs-commits
mailing list