You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2014/12/24 10:13:34 UTC

incubator-ignite git commit: # master Fixed test to avoid hang

Repository: incubator-ignite
Updated Branches:
  refs/heads/master c9aa93e62 -> c541d6598


# master Fixed test to avoid hang


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

Branch: refs/heads/master
Commit: c541d65987a019d0a2ee550422edaecd09ad5869
Parents: c9aa93e
Author: sboikov <sb...@gridgain.com>
Authored: Wed Dec 24 13:13:13 2014 +0400
Committer: sboikov <sb...@gridgain.com>
Committed: Wed Dec 24 13:13:13 2014 +0400

----------------------------------------------------------------------
 .../tcp/GridOrderedMessageCancelSelfTest.java   | 28 ++++++++++++--------
 1 file changed, 17 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c541d659/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridOrderedMessageCancelSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridOrderedMessageCancelSelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridOrderedMessageCancelSelfTest.java
index 3684f5e..2a8edcf 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridOrderedMessageCancelSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridOrderedMessageCancelSelfTest.java
@@ -31,6 +31,7 @@ import org.jetbrains.annotations.*;
 import java.util.*;
 import java.util.concurrent.*;
 
+import static java.util.concurrent.TimeUnit.*;
 import static org.gridgain.grid.cache.GridCacheMode.*;
 import static org.gridgain.grid.cache.GridCachePreloadMode.*;
 
@@ -125,7 +126,7 @@ public class GridOrderedMessageCancelSelfTest extends GridCommonAbstractTest {
 
         resLatch.countDown();
 
-        finishLatch.await();
+        assertTrue(U.await(finishLatch, 5000, MILLISECONDS));
 
         Map map = U.field(((GridKernal)grid(0)).context().io(), "msgSetMap");
 
@@ -145,21 +146,26 @@ public class GridOrderedMessageCancelSelfTest extends GridCommonAbstractTest {
         /** {@inheritDoc} */
         @Override protected void notifyListener(UUID sndId, GridTcpCommunicationMessageAdapter msg,
             IgniteRunnable msgC) {
-            GridIoMessage ioMsg = (GridIoMessage)msg;
+            try {
+                GridIoMessage ioMsg = (GridIoMessage)msg;
 
-            boolean wait = ioMsg.message() instanceof GridCacheQueryResponse ||
-                ioMsg.message() instanceof GridJobExecuteResponse;
+                boolean wait = ioMsg.message() instanceof GridCacheQueryResponse ||
+                        ioMsg.message() instanceof GridJobExecuteResponse;
 
-            if (wait) {
-                cancelLatch.countDown();
+                if (wait) {
+                    cancelLatch.countDown();
 
-                U.awaitQuiet(resLatch);
-            }
+                    assertTrue(U.await(resLatch, 5000, MILLISECONDS));
+                }
 
-            super.notifyListener(sndId, msg, msgC);
+                super.notifyListener(sndId, msg, msgC);
 
-            if (wait)
-                finishLatch.countDown();
+                if (wait)
+                    finishLatch.countDown();
+            }
+            catch (Exception e) {
+                fail("Unexpected error: " + e);
+            }
         }
     }