ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [3/4] incubator-ignite git commit: # master Fixed test to avoid hang
Date Wed, 24 Dec 2014 09:20:33 GMT
# 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/ignite-32
Commit: c541d65987a019d0a2ee550422edaecd09ad5869
Parents: c9aa93e
Author: sboikov <sboikov@gridgain.com>
Authored: Wed Dec 24 13:13:13 2014 +0400
Committer: sboikov <sboikov@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);
+            }
         }
     }
 


Mime
View raw message