You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by vk...@apache.org on 2015/06/02 05:51:12 UTC

[18/34] incubator-ignite git commit: IGNITE-891 - Cache store improvements

IGNITE-891 - Cache store improvements


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

Branch: refs/heads/ignite-sprint-5
Commit: 4a55d29fb278a93d4fef1cfe600607b11bda2d0f
Parents: b37d004
Author: Valentin Kulichenko <vk...@gridgain.com>
Authored: Thu May 21 19:52:58 2015 -0700
Committer: Valentin Kulichenko <vk...@gridgain.com>
Committed: Thu May 21 19:52:58 2015 -0700

----------------------------------------------------------------------
 .../transactions/IgniteTxLocalAdapter.java      | 44 +++++++++++---------
 1 file changed, 24 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4a55d29f/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 fdaef47..3e5a63c 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
@@ -661,21 +661,6 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter
         }
     }
 
-    /**
-     * @param stores Store managers.
-     * @return If {@code isWriteToStoreFromDht} value same for all stores.
-     */
-    private boolean isWriteToStoreFromDhtValid(Collection<CacheStoreManager> stores) {
-        boolean exp = F.first(stores).isWriteToStoreFromDht();
-
-        for (CacheStoreManager store : stores) {
-            if (store.isWriteToStoreFromDht() != exp)
-                return false;
-        }
-
-        return true;
-    }
-
     /** {@inheritDoc} */
     @SuppressWarnings({"CatchGenericClass"})
     @Override public void userCommit() throws IgniteCheckedException {
@@ -1101,13 +1086,15 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter
                 if (!internal()) {
                     Collection<CacheStoreManager> stores = stores();
 
-                    assert isWriteToStoreFromDhtValid(stores) :
-                        "isWriteToStoreFromDht can't be different within one transaction";
+                    if (stores != null && !stores.isEmpty()) {
+                        assert isWriteToStoreFromDhtValid(stores) :
+                            "isWriteToStoreFromDht can't be different within one transaction";
 
-                    boolean isWriteToStoreFromDht = F.first(stores).isWriteToStoreFromDht();
+                        boolean isWriteToStoreFromDht = F.first(stores).isWriteToStoreFromDht();
 
-                    if (stores != null && !stores.isEmpty() && (near() || isWriteToStoreFromDht))
-                        sessionEnd(stores, false);
+                        if (stores != null && !stores.isEmpty() && (near() || isWriteToStoreFromDht))
+                            sessionEnd(stores, false);
+                    }
                 }
             }
             catch (Error | IgniteCheckedException | RuntimeException e) {
@@ -3326,6 +3313,23 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter
     }
 
     /**
+     * @param stores Store managers.
+     * @return If {@code isWriteToStoreFromDht} value same for all stores.
+     */
+    private boolean isWriteToStoreFromDhtValid(Collection<CacheStoreManager> stores) {
+        if (stores != null && !stores.isEmpty()) {
+            boolean exp = F.first(stores).isWriteToStoreFromDht();
+
+            for (CacheStoreManager store : stores) {
+                if (store.isWriteToStoreFromDht() != exp)
+                    return false;
+            }
+        }
+
+        return true;
+    }
+
+    /**
      * Post-lock closure alias.
      *
      * @param <T> Return type.