ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [2/6] incubator-ignite git commit: minor - added busy lock for tryFailNode()
Date Wed, 22 Apr 2015 15:13:56 GMT
minor - added busy lock for tryFailNode()


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

Branch: refs/heads/ignite-774
Commit: 19e343c6576e029dea81c9fbf9a6a6e6f1f23de9
Parents: 702f172
Author: Yakov Zhdanov <yzhdanov@gridgain.com>
Authored: Wed Apr 22 16:07:23 2015 +0300
Committer: Yakov Zhdanov <yzhdanov@gridgain.com>
Committed: Wed Apr 22 16:07:23 2015 +0300

----------------------------------------------------------------------
 .../managers/discovery/GridDiscoveryManager.java  | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/19e343c6/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
b/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
index 11fa261..f6be4ed 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
@@ -1404,13 +1404,21 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi>
{
      * @return Whether node is failed.
      */
     public boolean tryFailNode(UUID nodeId) {
-        if (!getSpi().pingNode(nodeId)) {
-            getSpi().failNode(nodeId);
+        if (!busyLock.enterBusy())
+            return false;
 
-            return true;
-        }
+        try {
+            if (!getSpi().pingNode(nodeId)) {
+                getSpi().failNode(nodeId);
+
+                return true;
+            }
 
-        return false;
+            return false;
+        }
+        finally {
+            busyLock.leaveBusy();
+        }
     }
 
     /**


Mime
View raw message