ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [09/50] incubator-ignite git commit: IGNITE-709 Fix GridDiscoveryManagerAliveCacheSelfTest.testAlivesClient
Date Fri, 29 May 2015 12:46:16 GMT
IGNITE-709 Fix GridDiscoveryManagerAliveCacheSelfTest.testAlivesClient


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

Branch: refs/heads/ignite-929
Commit: 97533b331948cfe9c3be040d720e8ab646ba8bc5
Parents: de9c141
Author: sevdokimov <sergey.evdokimov@jetbrains.com>
Authored: Sun May 24 22:31:40 2015 +0300
Committer: sevdokimov <sergey.evdokimov@jetbrains.com>
Committed: Sun May 24 22:31:40 2015 +0300

----------------------------------------------------------------------
 .../GridDiscoveryManagerAliveCacheSelfTest.java | 41 ++++++++++++--------
 1 file changed, 25 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/97533b33/modules/core/src/test/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManagerAliveCacheSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManagerAliveCacheSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManagerAliveCacheSelfTest.java
index dce7d4b..55d4d80 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManagerAliveCacheSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManagerAliveCacheSelfTest.java
@@ -93,10 +93,18 @@ public class GridDiscoveryManagerAliveCacheSelfTest extends GridCommonAbstractTe
 
         if (clientMode && ((gridName.charAt(gridName.length() - 1) - '0') & 1)
!= 0)
             disc = new TcpClientDiscoverySpi();
-        else
-            disc = new TcpDiscoverySpi();
+        else {
+            TcpDiscoverySpi srvDisc = new TcpDiscoverySpi();
 
+            srvDisc.setMaxMissedClientHeartbeats(50);
+
+            disc = srvDisc;
+        }
+
+        disc.setHeartbeatFrequency(500);
         disc.setIpFinder(IP_FINDER);
+        disc.setAckTimeout(1000);
+        disc.setSocketTimeout(1000);
 
         cfg.setCacheConfiguration(cCfg);
         cfg.setDiscoverySpi(disc);
@@ -174,14 +182,10 @@ public class GridDiscoveryManagerAliveCacheSelfTest extends GridCommonAbstractTe
      */
     @SuppressWarnings("BusyWait")
     private void awaitDiscovery(long nodesCnt) throws InterruptedException {
-        Thread.sleep(50);
-
         for (Ignite g : alive) {
             if (g.configuration().getDiscoverySpi() instanceof TcpClientDiscoverySpi)
                 ((TcpClientDiscoverySpi)g.configuration().getDiscoverySpi()).waitForMessagePrecessed();
 
-            Thread.sleep(500);
-
             while (g.cluster().nodes().size() != nodesCnt)
                 Thread.sleep(10);
         }
@@ -246,23 +250,28 @@ public class GridDiscoveryManagerAliveCacheSelfTest extends GridCommonAbstractTe
      * Stops temporary nodes.
      */
     private void stopTempNodes() {
-        int rmv = 0;
+        Collection<Ignite> toRmv = new ArrayList<>(alive.subList(0, TMP_NODES_CNT));
 
-        Collection<Ignite> toRmv = new ArrayList<>(TMP_NODES_CNT);
+        alive.removeAll(toRmv);
 
-        for (Iterator<Ignite> iter = alive.iterator(); iter.hasNext() && rmv
< TMP_NODES_CNT;) {
-            toRmv.add(iter.next());
+        // Remove listeners to avoid receiving events from stopping nodes.
+        for (Ignite g : toRmv)
+            g.events().stopLocalListen(lsnr, EventType.EVT_NODE_LEFT, EventType.EVT_NODE_FAILED);
 
-            iter.remove();
+        for (Iterator<Ignite> itr = toRmv.iterator(); itr.hasNext(); ) {
+            Ignite g = itr.next();
 
-            rmv++;
+            if (g.cluster().node().isClient()) {
+                G.stop(g.name(), false);
+
+                itr.remove();
+            }
         }
 
-        // Remove listeners to avoid receiving events from stopping nodes.
-        for (Ignite g : toRmv)
-            g.events().stopLocalListen(lsnr, EventType.EVT_NODE_LEFT, EventType.EVT_NODE_FAILED);
+        for (Ignite g : toRmv) {
+            assert !g.cluster().localNode().isClient();
 
-        for (Ignite g : toRmv)
             G.stop(g.name(), false);
+        }
     }
 }


Mime
View raw message