[jboss-cvs] jboss-seam/src/main/org/jboss/seam/transaction ...
Gavin King
gavin.king at jboss.com
Sun Jun 24 19:57:18 EDT 2007
User: gavin
Date: 07/06/24 19:57:18
Modified: src/main/org/jboss/seam/transaction CMTTransaction.java
EjbTransaction.java Transaction.java
UTTransaction.java
Log:
detect attempt to register sync when no tx active
Revision Changes Path
1.3 +2 -0 jboss-seam/src/main/org/jboss/seam/transaction/CMTTransaction.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: CMTTransaction.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/transaction/CMTTransaction.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- CMTTransaction.java 24 Jun 2007 23:35:01 -0000 1.2
+++ CMTTransaction.java 24 Jun 2007 23:57:18 -0000 1.3
@@ -40,6 +40,7 @@
public void begin() throws NotSupportedException, SystemException
{
ejbContext.getUserTransaction().begin();
+ parent.afterBegin();
}
public void commit() throws RollbackException, HeuristicMixedException,
@@ -76,6 +77,7 @@
{
try
{
+ //TODO: not correct for SUPPORTS or NEVER!
if ( !ejbContext.getRollbackOnly() )
{
return Status.STATUS_ACTIVE;
1.2 +0 -1 jboss-seam/src/main/org/jboss/seam/transaction/EjbTransaction.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: EjbTransaction.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/transaction/EjbTransaction.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- EjbTransaction.java 24 Jun 2007 06:34:57 -0000 1.1
+++ EjbTransaction.java 24 Jun 2007 23:57:18 -0000 1.2
@@ -37,7 +37,6 @@
public class EjbTransaction extends Transaction
implements LocalEjbTransaction, SessionSynchronization
{
- public void afterBegin() throws EJBException, RemoteException {}
public void beforeCompletion() throws EJBException, RemoteException
{
1.11 +16 -2 jboss-seam/src/main/org/jboss/seam/transaction/Transaction.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: Transaction.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/transaction/Transaction.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- Transaction.java 24 Jun 2007 06:34:34 -0000 1.10
+++ Transaction.java 24 Jun 2007 23:57:18 -0000 1.11
@@ -40,21 +40,28 @@
private static String userTransactionName = "UserTransaction";
- private SynchronizationRegistry synchronizations = new SynchronizationRegistry();
+ private SynchronizationRegistry synchronizations;
protected SynchronizationRegistry getSynchronizations()
{
return synchronizations;
}
+ public void afterBegin()
+ {
+ synchronizations = new SynchronizationRegistry();
+ }
+
protected void afterCommit(boolean success)
{
synchronizations.afterTransactionCompletion(success);
+ synchronizations = null;
}
protected void afterRollback()
{
synchronizations.afterTransactionCompletion(false);
+ synchronizations = null;
}
protected void beforeCommit()
@@ -64,8 +71,15 @@
protected void registerSynchronization(Synchronization sync)
{
+ if (synchronizations==null)
+ {
+ throw new IllegalStateException("no transaction active, or the transaction is a CMT (try installing <transaction:ejb-transaction/>)");
+ }
+ else
+ {
synchronizations.registerSynchronization(sync);
}
+ }
protected boolean isAwareOfContainerTransactions()
{
1.6 +1 -0 jboss-seam/src/main/org/jboss/seam/transaction/UTTransaction.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: UTTransaction.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/transaction/UTTransaction.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- UTTransaction.java 24 Jun 2007 23:35:01 -0000 1.5
+++ UTTransaction.java 24 Jun 2007 23:57:18 -0000 1.6
@@ -34,6 +34,7 @@
public void begin() throws NotSupportedException, SystemException
{
delegate.begin();
+ parent.afterBegin();
}
public void commit() throws RollbackException, HeuristicMixedException,
More information about the jboss-cvs-commits
mailing list