ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [03/50] incubator-ignite git commit: # IGNITE-709 Fix assertion error in testTimeoutWaitingNodeAddedMessage()
Date Fri, 29 May 2015 12:46:10 GMT
# IGNITE-709 Fix assertion error in testTimeoutWaitingNodeAddedMessage()


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

Branch: refs/heads/ignite-929
Commit: 0ae75d8ca5c728c69e236d45952fa9398436961b
Parents: f2e0fc2
Author: sevdokimov <sevdokimov@gridgain.com>
Authored: Fri May 22 19:33:20 2015 +0300
Committer: sevdokimov <sevdokimov@gridgain.com>
Committed: Fri May 22 19:33:20 2015 +0300

----------------------------------------------------------------------
 .../discovery/tcp/TcpClientDiscoverySpi.java    |  4 +++
 .../tcp/TcpClientDiscoverySpiSelfTest.java      | 36 +++++++++++++++-----
 2 files changed, 31 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0ae75d8c/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoverySpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoverySpi.java
b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoverySpi.java
index bed4888..46e9635 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoverySpi.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoverySpi.java
@@ -1069,6 +1069,8 @@ public class TcpClientDiscoverySpi extends TcpDiscoverySpiAdapter implements
Tcp
                                 ", timeout=" + netTimeout + ']');
 
                             joinLatch.countDown();
+
+                            break;
                         }
                     }
                     else if (msg == SPI_STOP) {
@@ -1092,6 +1094,8 @@ public class TcpClientDiscoverySpi extends TcpDiscoverySpiAdapter implements
Tcp
                                 joinErr = new IgniteSpiException("Failed to connect to cluster:
socket closed.");
 
                                 joinLatch.countDown();
+
+                                break;
                             }
                             else {
                                 if (getSpiContext().isStopping() || segmented)

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0ae75d8c/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoverySpiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoverySpiSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoverySpiSelfTest.java
index a927110..727d505 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoverySpiSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoverySpiSelfTest.java
@@ -98,21 +98,25 @@ public class TcpClientDiscoverySpiSelfTest extends GridCommonAbstractTest
{
     /** */
     private long joinTimeout = TcpClientDiscoverySpi.DFLT_JOIN_TIMEOUT;
 
+    /** */
+    private long netTimeout = TcpDiscoverySpiAdapter.DFLT_NETWORK_TIMEOUT;
+
+    /** */
+    private boolean longSockTimeouts;
+
     /** {@inheritDoc} */
     @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception
{
         IgniteConfiguration cfg = super.getConfiguration(gridName);
 
+        TcpDiscoverySpiAdapter disco;
+
         if (gridName.startsWith("server")) {
-            TcpDiscoverySpi disco = new TcpDiscoverySpi();
+            disco = new TcpDiscoverySpi();
 
             disco.setIpFinder(IP_FINDER);
-
-            cfg.setDiscoverySpi(disco);
         }
         else if (gridName.startsWith("client")) {
-            TcpClientDiscoverySpi disco = new TestTcpClientDiscovery();
-
-            disco.setJoinTimeout(joinTimeout);
+            disco = new TestTcpClientDiscovery();
 
             TcpDiscoveryVmIpFinder ipFinder;
 
@@ -132,14 +136,24 @@ public class TcpClientDiscoverySpiSelfTest extends GridCommonAbstractTest
{
 
             disco.setIpFinder(ipFinder);
 
-            cfg.setDiscoverySpi(disco);
-
             String nodeId = cfg.getNodeId().toString();
 
             nodeId = "cc" + nodeId.substring(2);
 
             cfg.setNodeId(UUID.fromString(nodeId));
         }
+        else
+            throw new IllegalArgumentException();
+
+        if (longSockTimeouts) {
+            disco.setAckTimeout(2000);
+            disco.setSocketTimeout(2000);
+        }
+
+        disco.setJoinTimeout(joinTimeout);
+        disco.setNetworkTimeout(netTimeout);
+
+        cfg.setDiscoverySpi(disco);
 
         if (nodeId != null)
             cfg.setNodeId(nodeId);
@@ -171,6 +185,8 @@ public class TcpClientDiscoverySpiSelfTest extends GridCommonAbstractTest
{
         nodeId = null;
         clientIpFinder = null;
         joinTimeout = TcpClientDiscoverySpi.DFLT_JOIN_TIMEOUT;
+        netTimeout = TcpClientDiscoverySpi.DFLT_NETWORK_TIMEOUT;
+        longSockTimeouts = false;
 
         assert G.allGrids().isEmpty();
     }
@@ -793,6 +809,8 @@ public class TcpClientDiscoverySpiSelfTest extends GridCommonAbstractTest
{
      * @throws Exception If any error occurs.
      */
     public void testTimeoutWaitingNodeAddedMessage() throws Exception {
+        longSockTimeouts = true;
+
         startServerNodes(2);
 
         final CountDownLatch cnt = new CountDownLatch(1);
@@ -812,7 +830,7 @@ public class TcpClientDiscoverySpiSelfTest extends GridCommonAbstractTest
{
             });
 
         try {
-            joinTimeout = 500;
+            netTimeout = 500;
 
             startGrid("client-0");
 


Mime
View raw message