ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dma...@apache.org
Subject [28/29] ignite git commit: IGNITE-1911: fixes and improvements after the review
Date Fri, 20 Nov 2015 08:16:01 GMT
IGNITE-1911: fixes and improvements after the review


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

Branch: refs/heads/ignite-801
Commit: 71669ca012e58436e34337c99320d7aaa7b52188
Parents: 5d71e92
Author: Denis Magda <dmagda@gridgain.com>
Authored: Fri Nov 20 10:53:47 2015 +0300
Committer: Denis Magda <dmagda@gridgain.com>
Committed: Fri Nov 20 10:53:47 2015 +0300

----------------------------------------------------------------------
 .../ignite/spi/discovery/tcp/ServerImpl.java    | 26 +++++++++++++++++---
 .../spi/discovery/tcp/TcpDiscoverySelfTest.java | 16 +++++++++---
 2 files changed, 35 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/71669ca0/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 8543573..5014f98 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
@@ -56,6 +56,7 @@ import java.util.concurrent.ThreadPoolExecutor;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicReference;
 import javax.net.ssl.SSLException;
+import org.apache.ignite.Ignite;
 import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.IgniteException;
 import org.apache.ignite.IgniteLogger;
@@ -2158,11 +2159,28 @@ class ServerImpl extends TcpDiscoveryImpl {
                 super.body();
             }
             catch (Throwable e) {
-                if (!spi.isNodeStopping0() && spi.ignite() != null) {
-                    log.error("TcpDiscoverSpi's message worker thread failed abnormally.
Stopping the grid in order " +
-                        "to prevent cluster wide instability.", e);
+                if (!spi.isNodeStopping0()) {
+                    final Ignite ignite = spi.ignite();
 
-                    spi.ignite().close();
+                    if (ignite != null) {
+                        U.error(log, "TcpDiscoverSpi's message worker thread failed abnormally."
+
+                            "Stopping the grid in order to prevent cluster wide instability.",
e);
+
+                        new Thread(new Runnable() {
+                            @Override public void run() {
+                                try {
+                                    spi.ignite().close();
+
+                                    U.log(log, "Stopped the grid successfully in response
to TcpDiscoverySpi's " +
+                                        "message worker thread abnormal termination.");
+                                }
+                                catch (Throwable e) {
+                                    U.error(log, "Failed to stop the grid in response to
TcpDiscoverySpi's " +
+                                        "message worker thread abnormal termination.", e);
+                                }
+                            }
+                        }).start();
+                    }
                 }
 
                 // Must be processed by IgniteSpiThread as well.

http://git-wip-us.apache.org/repos/asf/ignite/blob/71669ca0/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySelfTest.java
b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySelfTest.java
index 2df26d1..42960e7 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySelfTest.java
@@ -1336,11 +1336,11 @@ public class TcpDiscoverySelfTest extends GridCommonAbstractTest {
         try {
             TestMessageWorkerFailureSpi spi0 = new TestMessageWorkerFailureSpi();
 
-            nodeSpi = spi0;
+            nodeSpi.set(spi0);
 
             final Ignite ignite0 = startGrid(0);
 
-            nodeSpi = new TcpDiscoverySpi();
+            nodeSpi.set(new TcpDiscoverySpi());
 
             Ignite ignite1 = startGrid(1);
 
@@ -1367,6 +1367,16 @@ public class TcpDiscoverySelfTest extends GridCommonAbstractTest {
             latch.await(15, TimeUnit.SECONDS);
 
             assertTrue(disconnected.get());
+
+            try {
+                ignite0.cluster().localNode().id();
+            }
+            catch (IllegalStateException e) {
+                if (e.getMessage().contains("Grid is in invalid state to perform this operation"))
+                    return;
+            }
+
+            fail();
         }
         finally {
             stopAllGrids();
@@ -1979,4 +1989,4 @@ public class TcpDiscoverySelfTest extends GridCommonAbstractTest {
     private Ignite startGridNoOptimize(String gridName) throws Exception {
         return G.start(getConfiguration(gridName));
     }
-}
\ No newline at end of file
+}


Mime
View raw message