ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [16/37] incubator-ignite git commit: # ignite-742 fixed get futures
Date Wed, 15 Apr 2015 10:16:00 GMT
# ignite-742 fixed get futures


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

Branch: refs/heads/ignite-738
Commit: 596535b7608989f8f4b0c84e35a1a6b74ee2eed9
Parents: 9c0ef57
Author: sboikov <sboikov@gridgain.com>
Authored: Tue Apr 14 15:16:55 2015 +0300
Committer: sboikov <sboikov@gridgain.com>
Committed: Tue Apr 14 15:16:55 2015 +0300

----------------------------------------------------------------------
 .../dht/GridPartitionedGetFuture.java            | 19 ++++++++++++-------
 .../distributed/near/GridNearGetFuture.java      | 19 ++++++++++++-------
 2 files changed, 24 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/596535b7/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedGetFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedGetFuture.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedGetFuture.java
index da2105d..d5db26d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedGetFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedGetFuture.java
@@ -207,11 +207,8 @@ public class GridPartitionedGetFuture<K, V> extends GridCompoundIdentityFuture<M
             if (isMini(fut)) {
                 MiniFuture f = (MiniFuture)fut;
 
-                if (f.node().id().equals(nodeId)) {
-                    f.onResult(new ClusterTopologyCheckedException("Remote node left grid
(will retry): " + nodeId));
-
-                    return true;
-                }
+                if (f.node().id().equals(nodeId))
+                    f.onNodeLeft(new ClusterTopologyCheckedException("Remote node left grid
(will retry): " + nodeId));
             }
 
         return false;
@@ -382,7 +379,7 @@ public class GridPartitionedGetFuture<K, V> extends GridCompoundIdentityFuture<M
                 catch (IgniteCheckedException e) {
                     // Fail the whole thing.
                     if (e instanceof ClusterTopologyCheckedException)
-                        fut.onResult((ClusterTopologyCheckedException)e);
+                        fut.onNodeLeft((ClusterTopologyCheckedException)e);
                     else
                         fut.onResult(e);
                 }
@@ -556,6 +553,9 @@ public class GridPartitionedGetFuture<K, V> extends GridCompoundIdentityFuture<M
         /** Topology version on which this future was mapped. */
         private AffinityTopologyVersion topVer;
 
+        /** {@code True} if remapped after node left. */
+        private boolean remapped;
+
         /**
          * @param node Node.
          * @param keys Keys.
@@ -603,7 +603,12 @@ public class GridPartitionedGetFuture<K, V> extends GridCompoundIdentityFuture<M
          * @param e Failure exception.
          */
         @SuppressWarnings("UnusedParameters")
-        void onResult(ClusterTopologyCheckedException e) {
+        synchronized void onNodeLeft(ClusterTopologyCheckedException e) {
+            if (remapped)
+                return;
+
+            remapped = true;
+
             if (log.isDebugEnabled())
                 log.debug("Remote node left grid while sending or waiting for reply (will
retry): " + this);
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/596535b7/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetFuture.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetFuture.java
index b1017d8..b1638ca 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetFuture.java
@@ -207,11 +207,8 @@ public final class GridNearGetFuture<K, V> extends GridCompoundIdentityFuture<Ma
             if (isMini(fut)) {
                 MiniFuture f = (MiniFuture)fut;
 
-                if (f.node().id().equals(nodeId)) {
-                    f.onResult(new ClusterTopologyCheckedException("Remote node left grid
(will retry): " + nodeId));
-
-                    return true;
-                }
+                if (f.node().id().equals(nodeId))
+                    f.onNodeLeft(new ClusterTopologyCheckedException("Remote node left grid
(will retry): " + nodeId));
             }
 
         return false;
@@ -382,7 +379,7 @@ public final class GridNearGetFuture<K, V> extends GridCompoundIdentityFuture<Ma
                 catch (IgniteCheckedException e) {
                     // Fail the whole thing.
                     if (e instanceof ClusterTopologyCheckedException)
-                        fut.onResult((ClusterTopologyCheckedException)e);
+                        fut.onNodeLeft((ClusterTopologyCheckedException) e);
                     else
                         fut.onResult(e);
                 }
@@ -668,6 +665,9 @@ public final class GridNearGetFuture<K, V> extends GridCompoundIdentityFuture<Ma
         /** Topology version on which this future was mapped. */
         private AffinityTopologyVersion topVer;
 
+        /** {@code True} if remapped after node left. */
+        private boolean remapped;
+
         /**
          * @param node Node.
          * @param keys Keys.
@@ -721,7 +721,12 @@ public final class GridNearGetFuture<K, V> extends GridCompoundIdentityFuture<Ma
         /**
          * @param e Topology exception.
          */
-        void onResult(ClusterTopologyCheckedException e) {
+        synchronized void onNodeLeft(ClusterTopologyCheckedException e) {
+            if (remapped)
+                return;
+
+            remapped = true;
+
             if (log.isDebugEnabled())
                 log.debug("Remote node left grid while sending or waiting for reply (will
retry): " + this);
 


Mime
View raw message