[seam-commits] Seam SVN: r10551 - branches/community/Seam_2_1/src/main/org/jboss/seam/transaction.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Tue Apr 21 15:28:10 EDT 2009


Author: norman.richards at jboss.com
Date: 2009-04-21 15:28:10 -0400 (Tue, 21 Apr 2009)
New Revision: 10551

Modified:
   branches/community/Seam_2_1/src/main/org/jboss/seam/transaction/SeSynchronizations.java
Log:
JBSEAM-4106

Modified: branches/community/Seam_2_1/src/main/org/jboss/seam/transaction/SeSynchronizations.java
===================================================================
--- branches/community/Seam_2_1/src/main/org/jboss/seam/transaction/SeSynchronizations.java	2009-04-21 15:55:05 UTC (rev 10550)
+++ branches/community/Seam_2_1/src/main/org/jboss/seam/transaction/SeSynchronizations.java	2009-04-21 19:28:10 UTC (rev 10551)
@@ -13,59 +13,53 @@
 import org.jboss.seam.annotations.intercept.BypassInterceptors;
 
 /**
- * This implementation does not have access
- * to the JTA TransactionManager, so it is not fully aware
- * of container managed transaction lifecycle, and is not
- * able to register Synchronizations with a container managed 
- * transaction.
+ * This implementation does not have access to the JTA TransactionManager, so it
+ * is not fully aware of container managed transaction lifecycle, and is not
+ * able to register Synchronizations with a container managed transaction.
  * 
  * @author Gavin King
  * 
  */
 @Name("org.jboss.seam.transaction.synchronizations")
 @Scope(ScopeType.EVENT)
- at Install(precedence=BUILT_IN)
+ at Install(precedence = BUILT_IN)
 @BypassInterceptors
-public class SeSynchronizations implements Synchronizations
-{
-   protected Stack<SynchronizationRegistry> synchronizations = new Stack<SynchronizationRegistry>();
-   
-   public void afterTransactionBegin()
-   {
-      synchronizations.push( new SynchronizationRegistry() );
-   }
-   
-   public void afterTransactionCommit(boolean success)
-   {
-      synchronizations.pop().afterTransactionCompletion(success);
-   }
-   
-   public void afterTransactionRollback()
-   {
-      synchronizations.pop().afterTransactionCompletion(false);
-   }
-   
-   public void beforeTransactionCommit()
-   {
-      synchronizations.peek().beforeTransactionCompletion();
-   }
-   
-   public void registerSynchronization(Synchronization sync)
-   {
-      if (synchronizations.isEmpty())
-      {
-         throw new IllegalStateException("Transaction begin not detected, " +
-         "try installing transaction:ejb-transaction in components.xml");         
-      }
-      else
-      {
-         synchronizations.peek().registerSynchronization(sync);
-      }
-   }
-   
-   public boolean isAwareOfContainerTransactions()
-   {
-      return false;
-   }
-   
+public class SeSynchronizations implements Synchronizations {
+    protected Stack<SynchronizationRegistry> synchronizations = new Stack<SynchronizationRegistry>();
+
+    
+    public void afterTransactionBegin() {        
+        synchronizations.push(new SynchronizationRegistry());
+    }
+
+    public void afterTransactionCommit(boolean success) {        
+        if (!synchronizations.isEmpty()) {
+            synchronizations.pop().afterTransactionCompletion(success);
+        }
+    }
+
+    public void afterTransactionRollback() {
+        if (!synchronizations.isEmpty()) {
+            synchronizations.pop().afterTransactionCompletion(false);
+        }
+    }
+
+    public void beforeTransactionCommit() {
+        if (!synchronizations.isEmpty()) {
+            synchronizations.peek().beforeTransactionCompletion();
+        }
+    }
+
+    public void registerSynchronization(Synchronization sync) {
+        if (synchronizations.isEmpty()) {
+            throw new IllegalStateException("Transaction begin not detected, try installing transaction:ejb-transaction in components.xml");
+        } else {
+            synchronizations.peek().registerSynchronization(sync);
+        }
+    }
+
+    public boolean isAwareOfContainerTransactions() {
+        return false;
+    }
+
 }




More information about the seam-commits mailing list