You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@deltaspike.apache.org by gp...@apache.org on 2012/08/08 18:54:33 UTC

git commit: DELTASPIKE-250 updated status checks

Updated Branches:
  refs/heads/master 2b038d4d0 -> 60913d181


DELTASPIKE-250 updated status checks


Project: http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/commit/60913d18
Tree: http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/tree/60913d18
Diff: http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/diff/60913d18

Branch: refs/heads/master
Commit: 60913d18121a0ea43cb23138316cf8816a8659c2
Parents: 2b038d4
Author: gpetracek <gp...@apache.org>
Authored: Wed Aug 8 18:04:09 2012 +0200
Committer: gpetracek <gp...@apache.org>
Committed: Wed Aug 8 18:52:40 2012 +0200

----------------------------------------------------------------------
 .../BeanManagedUserTransactionStrategy.java        |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/60913d18/deltaspike/modules/jpa/impl/src/main/java/org/apache/deltaspike/jpa/impl/transaction/BeanManagedUserTransactionStrategy.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/jpa/impl/src/main/java/org/apache/deltaspike/jpa/impl/transaction/BeanManagedUserTransactionStrategy.java b/deltaspike/modules/jpa/impl/src/main/java/org/apache/deltaspike/jpa/impl/transaction/BeanManagedUserTransactionStrategy.java
index a450c8c..b814c7f 100644
--- a/deltaspike/modules/jpa/impl/src/main/java/org/apache/deltaspike/jpa/impl/transaction/BeanManagedUserTransactionStrategy.java
+++ b/deltaspike/modules/jpa/impl/src/main/java/org/apache/deltaspike/jpa/impl/transaction/BeanManagedUserTransactionStrategy.java
@@ -252,14 +252,16 @@ public class BeanManagedUserTransactionStrategy extends ResourceLocalTransaction
             }
         }
 
-        private boolean isTransactionAllowedToRollback() throws SystemException
+        protected boolean isTransactionAllowedToRollback() throws SystemException
         {
-            return isTransactionReadyToCommit() ||
-                    this.userTransaction.getStatus() == Status.STATUS_MARKED_ROLLBACK ||
-                    this.userTransaction.getStatus() == Status.STATUS_COMMITTING;
+            //if the following gets changed, it needs to be tested with different constellations
+            //(normal exception, timeout,...) as well as servers
+            return  this.userTransaction.getStatus() != Status.STATUS_COMMITTED &&
+                    this.userTransaction.getStatus() != Status.STATUS_NO_TRANSACTION &&
+                    this.userTransaction.getStatus() != Status.STATUS_UNKNOWN;
         }
 
-        private boolean isTransactionReadyToCommit() throws SystemException
+        protected boolean isTransactionReadyToCommit() throws SystemException
         {
             return this.userTransaction.getStatus() == Status.STATUS_ACTIVE ||
                     this.userTransaction.getStatus() == Status.STATUS_PREPARING ||