ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agoncha...@apache.org
Subject ignite git commit: IGNITE-9726 Prevent the whole suite lockup after GridCacheAbstractFailoverSelfTest failure - Fixes #4859.
Date Thu, 11 Oct 2018 15:47:12 GMT
Repository: ignite
Updated Branches:
  refs/heads/master 88df5ee60 -> 584652293


IGNITE-9726 Prevent the whole suite lockup after GridCacheAbstractFailoverSelfTest failure
- Fixes #4859.

Signed-off-by: Alexey Goncharuk <alexey.goncharuk@gmail.com>


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

Branch: refs/heads/master
Commit: 584652293c8646d8a893eed1a2b2ae1a179a5d20
Parents: 88df5ee
Author: Alexey Platonov <aplatonovv@gmail.com>
Authored: Thu Oct 11 18:42:28 2018 +0300
Committer: Alexey Goncharuk <alexey.goncharuk@gmail.com>
Committed: Thu Oct 11 18:46:00 2018 +0300

----------------------------------------------------------------------
 .../GridCacheAbstractFailoverSelfTest.java      | 20 +++++++++++++++-----
 .../ignite/testframework/GridTestUtils.java     | 11 +++++++++--
 2 files changed, 24 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/58465229/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFailoverSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFailoverSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFailoverSelfTest.java
index 26f7529..5c204c7 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFailoverSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFailoverSelfTest.java
@@ -228,8 +228,10 @@ public abstract class GridCacheAbstractFailoverSelfTest extends GridCacheAbstrac
             }
         }, TOP_CHANGE_THREAD_CNT, "topology-change-thread");
 
+        boolean isInterrupted = false;
+
         try {
-            while (!fut.isDone()) {
+            while (!fut.isDone() && !isInterrupted) {
                 if (tx) {
                     remove(grid(0), jcache(), half, concurrency, isolation);
                     put(grid(0), jcache(), half, concurrency, isolation);
@@ -238,6 +240,14 @@ public abstract class GridCacheAbstractFailoverSelfTest extends GridCacheAbstrac
                     remove(jcache(), half);
                     put(jcache(), half);
                 }
+
+                isInterrupted = Thread.currentThread().isInterrupted();
+            }
+
+            if (isInterrupted) {
+                Thread.currentThread().interrupt();
+
+                fut.cancel();
             }
         }
         catch (Exception e) {
@@ -248,7 +258,8 @@ public abstract class GridCacheAbstractFailoverSelfTest extends GridCacheAbstrac
             throw e;
         }
 
-        fut.get();
+        if (!isInterrupted)
+            fut.get();
 
         Exception err0 = err.get();
 
@@ -285,8 +296,7 @@ public abstract class GridCacheAbstractFailoverSelfTest extends GridCacheAbstrac
         final int cnt,
         TransactionConcurrency concurrency,
         TransactionIsolation isolation)
-        throws Exception
-    {
+        throws Exception {
         try {
             info("Putting values to cache [0," + cnt + ')');
 
@@ -383,7 +393,7 @@ public abstract class GridCacheAbstractFailoverSelfTest extends GridCacheAbstrac
      * @param g Grid.
      * @return Cache.
      */
-    private IgniteCache<String,Integer> cache(Ignite g) {
+    private IgniteCache<String, Integer> cache(Ignite g) {
         return g.cache(DEFAULT_CACHE_NAME);
     }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/58465229/modules/core/src/test/java/org/apache/ignite/testframework/GridTestUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/GridTestUtils.java
b/modules/core/src/test/java/org/apache/ignite/testframework/GridTestUtils.java
index 73293ce..ad55e40 100644
--- a/modules/core/src/test/java/org/apache/ignite/testframework/GridTestUtils.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/GridTestUtils.java
@@ -905,8 +905,15 @@ public final class GridTestUtils {
         }
 
         // Wait threads finish their job.
-        for (Thread t : threads)
-            t.join();
+        try {
+            for (Thread t : threads)
+                t.join();
+        } catch (InterruptedException e) {
+            for (Thread t : threads)
+                t.interrupt();
+
+            throw e;
+        }
 
         time = System.currentTimeMillis() - time;
 


Mime
View raw message