This is an automated email from the ASF dual-hosted git repository.

mmuzaf pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/master by this push:
     new 31d6ad7  IGNITE-12501: Clarify checked exception on node left to the 
ClusterTopologyCheckedException (#7203)
31d6ad7 is described below

commit 31d6ad7e1704e6ebd038fa87dca9c7354f490fd0
Author: Nikita Amelchev <nsamelc...@gmail.com>
AuthorDate: Sat Dec 28 04:37:02 2019 +0300

    IGNITE-12501: Clarify checked exception on node left to the 
ClusterTopologyCheckedException (#7203)
---
 .../spi/communication/tcp/TcpCommunicationSpi.java |  2 +-
 .../AuthenticationProcessorNodeRestartTest.java    | 39 ++++++++++------------
 2 files changed, 18 insertions(+), 23 deletions(-)

diff --git 
a/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
 
b/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
index 99dd212..65efb4f 100755
--- 
a/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
@@ -2862,7 +2862,7 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter 
implements Communicati
                         ClusterNode node0 = getSpiContext().node(node.id());
 
                         if (node0 == null)
-                            throw new IgniteCheckedException("Failed to send 
message to remote node " +
+                            throw new ClusterTopologyCheckedException("Failed 
to send message to remote node " +
                                 "(node has left the grid): " + node.id());
                     }
 
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/authentication/AuthenticationProcessorNodeRestartTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/authentication/AuthenticationProcessorNodeRestartTest.java
index 762da04..040d68e 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/authentication/AuthenticationProcessorNodeRestartTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/authentication/AuthenticationProcessorNodeRestartTest.java
@@ -24,6 +24,7 @@ import 
org.apache.ignite.configuration.DataRegionConfiguration;
 import org.apache.ignite.configuration.DataStorageConfiguration;
 import org.apache.ignite.configuration.IgniteConfiguration;
 import org.apache.ignite.internal.IgniteInternalFuture;
+import org.apache.ignite.internal.cluster.ClusterTopologyCheckedException;
 import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.testframework.GridTestUtils;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
@@ -191,7 +192,8 @@ public class AuthenticationProcessorNodeRestartTest extends 
GridCommonAbstractTe
                 }
             }
             catch (Exception e) {
-                e.printStackTrace(System.err);
+                log.error("Unexpected exception.", e);
+
                 fail("Unexpected exception on server restart: " + 
e.getMessage());
             }
         });
@@ -209,15 +211,12 @@ public class AuthenticationProcessorNodeRestartTest 
extends GridCommonAbstractTe
                     assertNotNull(actx);
                 }
             }
-            catch (IgniteCheckedException e) {
-                // Skip exception if server down.
-                if (!serverDownMessage(e.getMessage())) {
-                    e.printStackTrace();
-                    fail("Unexpected exception: " + e.getMessage());
-                }
+            catch (ClusterTopologyCheckedException ignored) {
+                // No-op.
             }
             catch (Exception e) {
-                e.printStackTrace();
+                log.error("Unexpected exception.", e);
+
                 fail("Unexpected exception: " + e.getMessage());
             }
         }, testUsersCnt, "user-op");
@@ -226,15 +225,6 @@ public class AuthenticationProcessorNodeRestartTest 
extends GridCommonAbstractTe
     }
 
     /**
-     * Exception messages from {@code 
org.apache.ignite.internal.managers.communication.GridIoManager#send}.
-     */
-    private boolean serverDownMessage(String text) {
-        return text.contains("Failed to send message (node may have left the 
grid or "
-            + "TCP connection cannot be established due to firewall issues)")
-            || text.contains("Failed to send message, node left");
-    }
-
-    /**
      * @return Future.
      */
     private IgniteInternalFuture restartCoordinator() {
@@ -283,7 +273,8 @@ public class AuthenticationProcessorNodeRestartTest extends 
GridCommonAbstractTe
                 }
             }
             catch (Exception e) {
-                e.printStackTrace();
+                log.error("Unexpected exception.", e);
+
                 fail("Unexpected exception on add / remove");
             }
         }, 3, "user-op");
@@ -303,7 +294,8 @@ public class AuthenticationProcessorNodeRestartTest extends 
GridCommonAbstractTe
                 }
             }
             catch (Exception e) {
-                e.printStackTrace();
+                log.error("Unexpected exception.", e);
+
                 fail("Unexpected exception on add / remove");
             }
         }, 3, "user-op");
@@ -345,7 +337,8 @@ public class AuthenticationProcessorNodeRestartTest extends 
GridCommonAbstractTe
                 }
             }
             catch (Exception e) {
-                e.printStackTrace();
+                log.error("Unexpected exception.", e);
+
                 fail("Unexpected exception on add / remove");
             }
         }, 10, "user-op");
@@ -377,7 +370,8 @@ public class AuthenticationProcessorNodeRestartTest extends 
GridCommonAbstractTe
                 }
             }
             catch (Exception e) {
-                e.printStackTrace();
+                log.error("Unexpected exception.", e);
+
                 fail("Unexpected error on failed operation");
             }
         }, 10, "user-op");
@@ -400,7 +394,8 @@ public class AuthenticationProcessorNodeRestartTest extends 
GridCommonAbstractTe
                 }
             }
             catch (Exception e) {
-                e.printStackTrace(System.err);
+                log.error("Unexpected exception.", e);
+
                 fail("Unexpected exception on server restart: " + 
e.getMessage());
             }
         });

Reply via email to