Repository: incubator-ignite
Updated Branches:
  refs/heads/ignite-1229 068b4e321 -> a463d1dc6


ignite-946: reverted renaming topVer to avoid breaking compatibility


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

Branch: refs/heads/ignite-1229
Commit: a463d1dc6977b2f5514acbda49d090841182df71
Parents: 068b4e3
Author: Denis Magda <dma...@gridgain.com>
Authored: Wed Aug 12 10:53:16 2015 +0300
Committer: Denis Magda <dma...@gridgain.com>
Committed: Wed Aug 12 10:53:16 2015 +0300

----------------------------------------------------------------------
 .../ignite/spi/discovery/tcp/ServerImpl.java    | 48 ++++++++++----------
 .../tcp/internal/IgniteNodeLeftException.java   | 40 ----------------
 2 files changed, 25 insertions(+), 63 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a463d1dc/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
 
b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
index 331b286..dbfbc57 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
@@ -386,10 +386,13 @@ class ServerImpl extends TcpDiscoveryImpl {
         if (nodeId == getLocalNodeId())
             return true;
 
-        if (!nodeAlive(nodeId))
+        TcpDiscoveryNode node = ring.node(nodeId);
+
+        if (node == null)
             return false;
 
-        TcpDiscoveryNode node = ring.node(nodeId);
+        if (!nodeAlive(nodeId))
+            return false;
 
         boolean res = pingNode(node);
 
@@ -430,6 +433,10 @@ class ServerImpl extends TcpDiscoveryImpl {
                 // ID returned by the node should be the same as ID of the 
parameter for ping to succeed.
                 IgniteBiTuple<UUID, Boolean> t = pingNode(addr, node.id(), 
clientNodeId);
 
+                if (t == null)
+                    // Remote node left topology.
+                    return false;
+
                 boolean res = node.id().equals(t.get1()) && (clientNodeId == 
null || t.get2());
 
                 if (res)
@@ -437,14 +444,6 @@ class ServerImpl extends TcpDiscoveryImpl {
 
                 return res;
             }
-            catch (IgniteNodeLeftException e) {
-                if (log.isDebugEnabled())
-                    log.debug("Failed to ping node [node=" + node + ", err=" + 
e.getMessage() + ']');
-
-                onException("Failed to ping node [node=" + node + ", err=" + 
e.getMessage() + ']', e);
-
-                return false;
-            }
             catch (IgniteCheckedException e) {
                 if (log.isDebugEnabled())
                     log.debug("Failed to ping node [node=" + node + ", err=" + 
e.getMessage() + ']');
@@ -463,10 +462,11 @@ class ServerImpl extends TcpDiscoveryImpl {
      * @param addr Address of the node.
      * @param nodeId Node ID to ping. In case when client node ID is not null 
this node ID is an ID of the router node.
      * @param clientNodeId Client node ID.
-     * @return ID of the remote node and "client exists" flag if node alive.
+     * @return ID of the remote node and "client exists" flag if node alive or 
{@code null} if the remote node has
+     *         left a topology during the ping process.
      * @throws IgniteCheckedException If an error occurs.
      */
-    private IgniteBiTuple<UUID, Boolean> pingNode(InetSocketAddress addr, 
@Nullable UUID nodeId,
+    private @Nullable IgniteBiTuple<UUID, Boolean> pingNode(InetSocketAddress 
addr, @Nullable UUID nodeId,
         @Nullable UUID clientNodeId) throws IgniteCheckedException {
         assert addr != null;
 
@@ -546,9 +546,13 @@ class ServerImpl extends TcpDiscoveryImpl {
                         return t;
                     }
                     catch (IOException | IgniteCheckedException e) {
-                        if (nodeId != null && !nodeAlive(nodeId))
-                            throw new IgniteNodeLeftException("Failed to ping 
node (node already left or leaving" +
-                                " the ring) [nodeId=" + nodeId + ", addr=" + 
addr +']', e);
+                        if (nodeId != null && !nodeAlive(nodeId)) {
+                            if (log.isDebugEnabled())
+                                log.debug("Failed to ping the node (has left 
or leaving topology): [nodeId=" + nodeId +
+                                    ']');
+
+                            return null;
+                        }
 
                         if (errs == null)
                             errs = new ArrayList<>();
@@ -1422,17 +1426,15 @@ class ServerImpl extends TcpDiscoveryImpl {
 
             b.append("Leaving nodes: ").append(U.nl());
 
-            synchronized (mux) {
-                for (TcpDiscoveryNode node : leavingNodes)
-                    b.append("    ").append(node.id()).append(U.nl());
+            for (TcpDiscoveryNode node : leavingNodes)
+                b.append("    ").append(node.id()).append(U.nl());
 
-                b.append(U.nl());
+            b.append(U.nl());
 
-                b.append("Failed nodes: ").append(U.nl());
+            b.append("Failed nodes: ").append(U.nl());
 
-                for (TcpDiscoveryNode node : failedNodes)
-                    b.append("    ").append(node.id()).append(U.nl());
-            }
+            for (TcpDiscoveryNode node : failedNodes)
+                b.append("    ").append(node.id()).append(U.nl());
 
             b.append(U.nl());
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a463d1dc/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/internal/IgniteNodeLeftException.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/internal/IgniteNodeLeftException.java
 
b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/internal/IgniteNodeLeftException.java
deleted file mode 100644
index 80bcc67..0000000
--- 
a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/internal/IgniteNodeLeftException.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.spi.discovery.tcp.internal;
-
-import org.apache.ignite.*;
-
-import org.jetbrains.annotations.*;
-
-/**
- * Thrown when there is an attempt to talk to the node that has already left 
the ring.
- */
-public class IgniteNodeLeftException extends IgniteCheckedException {
-    /** */
-    private static final long serialVersionUID = 0L;
-
-    /**
-     * Creates new exception with given error message and optional nested 
exception.
-     *
-     * @param msg Error message.
-     * @param cause Optional nested exception (can be {@code null}).
-     */
-    public IgniteNodeLeftException(String msg, @Nullable Throwable cause) {
-        super(msg, cause);
-    }
-}

Reply via email to