Repository: ignite
Updated Branches:
  refs/heads/ignite-1537 96c35103c -> 5fa5f861e


ignite-1.5


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/5fa5f861
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/5fa5f861
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/5fa5f861

Branch: refs/heads/ignite-1537
Commit: 5fa5f861e18c59a85c22db7e346aacb549a87a07
Parents: 96c3510
Author: sboikov <sboi...@gridgain.com>
Authored: Mon Dec 28 09:43:33 2015 +0300
Committer: sboikov <sboi...@gridgain.com>
Committed: Mon Dec 28 09:43:33 2015 +0300

----------------------------------------------------------------------
 .../cache/transactions/IgniteTxAdapter.java       | 18 ++++++++++++++++++
 .../cache/transactions/IgniteTxHandler.java       | 10 ++++------
 .../cache/transactions/IgniteTxLocalAdapter.java  |  6 +++---
 3 files changed, 25 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/5fa5f861/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java
index c13e86b..afcec88 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java
@@ -799,6 +799,24 @@ public abstract class IgniteTxAdapter extends 
GridMetadataAwareAdapter
         return state;
     }
 
+    /**
+     *
+     */
+    protected final void errorWhenCommitting() {
+        synchronized (this) {
+            TransactionState prev = state;
+
+            assert prev == COMMITTING : prev;
+
+            state = MARKED_ROLLBACK;
+
+            if (log.isDebugEnabled())
+                log.debug("Changed transaction state [prev=" + prev + ", new=" 
+ this.state + ", tx=" + this + ']');
+
+            notifyAll();
+        }
+    }
+
     /** {@inheritDoc} */
     @Override public boolean setRollbackOnly() {
         return state(MARKED_ROLLBACK);

http://git-wip-us.apache.org/repos/asf/ignite/blob/5fa5f861/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java
index b25baf8..ec0ca7c 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java
@@ -721,14 +721,12 @@ public class IgniteTxHandler {
 
             IgniteInternalFuture<IgniteInternalTx> res = null;
 
-            if (tx != null) {
-                IgniteInternalFuture<IgniteInternalTx> rollbackFut = 
tx.rollbackAsync();
+            IgniteInternalFuture<IgniteInternalTx> rollbackFut = 
tx.rollbackAsync();
 
-                // Only for error logging.
-                rollbackFut.listen(CU.errorLogger(log));
+            // Only for error logging.
+            rollbackFut.listen(CU.errorLogger(log));
 
-                res = rollbackFut;
-            }
+            res = rollbackFut;
 
             if (e instanceof Error)
                 throw (Error)e;

http://git-wip-us.apache.org/repos/asf/ignite/blob/5fa5f861/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
index 70c79a5..7e4efd9 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
@@ -801,7 +801,7 @@ public abstract class IgniteTxLocalAdapter extends 
IgniteTxAdapter
             catch (IgniteCheckedException ex) {
                 commitError(ex);
 
-                setRollbackOnly();
+                errorWhenCommitting();
 
                 // Safe to remove transaction from committed tx list because 
nothing was committed yet.
                 cctx.tm().removeCommittedTx(this);
@@ -811,7 +811,7 @@ public abstract class IgniteTxLocalAdapter extends 
IgniteTxAdapter
             catch (Throwable ex) {
                 commitError(ex);
 
-                setRollbackOnly();
+                errorWhenCommitting();
 
                 // Safe to remove transaction from committed tx list because 
nothing was committed yet.
                 cctx.tm().removeCommittedTx(this);
@@ -1153,7 +1153,7 @@ public abstract class IgniteTxLocalAdapter extends 
IgniteTxAdapter
                             // Set operation to NOOP.
                             txEntry.op(NOOP);
 
-                            setRollbackOnly();
+                            errorWhenCommitting();
 
                             throw ex;
                         }

Reply via email to