ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject ignite git commit: ignite-3300 Fixed potential race.
Date Fri, 22 Jul 2016 13:32:58 GMT
Repository: ignite
Updated Branches:
  refs/heads/master 2007cf859 -> d88f7787d


ignite-3300 Fixed potential race.


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

Branch: refs/heads/master
Commit: d88f7787dfcd7cc6207a3a8f7416130f8c2fe757
Parents: 2007cf8
Author: sboikov <sboikov@gridgain.com>
Authored: Fri Jul 22 16:32:26 2016 +0300
Committer: sboikov <sboikov@gridgain.com>
Committed: Fri Jul 22 16:32:53 2016 +0300

----------------------------------------------------------------------
 .../processors/cache/GridCacheAffinityManager.java      | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/d88f7787/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAffinityManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAffinityManager.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAffinityManager.java
index 5e843dc..d182bb4 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAffinityManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAffinityManager.java
@@ -197,15 +197,21 @@ public class GridCacheAffinityManager extends GridCacheManagerAdapter
{
     public int partition(Object key) {
         GridAffinityAssignmentCache aff0 = aff;
 
-        if (key instanceof KeyCacheObject && ((KeyCacheObject)key).partition() !=
-1)
-            return ((KeyCacheObject)key).partition();
+        boolean keyObj = key instanceof KeyCacheObject;
+
+        if (key instanceof KeyCacheObject) {
+            int part = ((KeyCacheObject)key).partition();
+
+            if (part != -1)
+                return part;
+        }
 
         if (aff0 == null)
             throw new IgniteException(FAILED_TO_FIND_CACHE_ERR_MSG + cctx.name());
 
         int p = affFunction.partition(affinityKey(key));
 
-        if (key instanceof KeyCacheObject)
+        if (keyObj)
             ((KeyCacheObject)key).partition(p);
 
         return p;


Mime
View raw message