Repository: incubator-ignite
Updated Branches:
  refs/heads/ignite-96 df3a3b3eb -> fd700908a


IGNITE-96 - Fixed hang in test


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

Branch: refs/heads/ignite-96
Commit: fd700908a7d5e053b78367e0a5634125e5a4e947
Parents: df3a3b3
Author: Alexey Goncharuk <agoncha...@gridgain.com>
Authored: Sat Feb 7 14:50:25 2015 -0800
Committer: Alexey Goncharuk <agoncha...@gridgain.com>
Committed: Sat Feb 7 14:50:25 2015 -0800

----------------------------------------------------------------------
 .../distributed/GridCacheEventAbstractTest.java | 66 ++++++++++----------
 1 file changed, 33 insertions(+), 33 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fd700908/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheEventAbstractTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheEventAbstractTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheEventAbstractTest.java
index 588d765..cc69a5f 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheEventAbstractTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheEventAbstractTest.java
@@ -542,30 +542,30 @@ public abstract class GridCacheEventAbstractTest extends 
GridCacheAbstractSelfTe
             @Override public void run(GridCache<String, Integer> cache) throws 
IgniteCheckedException {
                 Iterator<Map.Entry<String, Integer>> iter = 
pairs(2).entrySet().iterator();
 
-                IgniteTx tx = cache.txStart();
-
                 Map.Entry<String, Integer> e = iter.next();
 
                 String key = e.getKey();
                 Integer val = e.getValue();
 
-                assert cache.putIfAbsent(key, val) == null;
+                try (IgniteTx tx = cache.txStart()) {
+                    assert cache.putIfAbsent(key, val) == null;
 
-                assertEquals(val, cache.putIfAbsent(key, val));
+                    assertEquals(val, cache.putIfAbsent(key, val));
 
-                assert cache.containsKey(key);
+                    assert cache.containsKey(key);
 
-                e = iter.next();
+                    e = iter.next();
 
-                key = e.getKey();
-                val = e.getValue();
+                    key = e.getKey();
+                    val = e.getValue();
 
-                assert cache.putxIfAbsent(key, val);
-                assert !cache.putxIfAbsent(key, val);
+                    assert cache.putxIfAbsent(key, val);
+                    assert !cache.putxIfAbsent(key, val);
 
-                assert cache.containsKey(key);
+                    assert cache.containsKey(key);
 
-                tx.commit();
+                    tx.commit();
+                }
 
                 assert cache.containsKey(key);
             }
@@ -692,19 +692,19 @@ public abstract class GridCacheEventAbstractTest extends 
GridCacheAbstractSelfTe
                 Integer val = e.getValue();
 
                 // Optimistic.
-                IgniteTx tx = cache.txStart();
-
-                assert !cache.putx(key, val, hasPeekVal);
-                assert cache.putx(key, val, noPeekVal);
+                try (IgniteTx tx = cache.txStart()) {
+                    assert !cache.putx(key, val, hasPeekVal);
+                    assert cache.putx(key, val, noPeekVal);
 
-                assert cache.containsKey(key);
+                    assert cache.containsKey(key);
 
-                assert !cache.removex(key, noPeekVal);
-                assert cache.removex(key);
+                    assert !cache.removex(key, noPeekVal);
+                    assert cache.removex(key);
 
-                assert !cache.containsKey(key);
+                    assert !cache.containsKey(key);
 
-                tx.commit();
+                    tx.commit();
+                }
 
                 assert !cache.containsKey(key);
             }
@@ -727,24 +727,24 @@ public abstract class GridCacheEventAbstractTest extends 
GridCacheAbstractSelfTe
                 String key = e.getKey();
                 Integer val = e.getValue();
 
-                IgniteTx tx = cache.txStart();
+                try (IgniteTx tx = cache.txStart()) {
+                    assert !cache.putx(key, val, hasPeekVal);
+                    assert cache.putx(key, val, noPeekVal);
 
-                assert !cache.putx(key, val, hasPeekVal);
-                assert cache.putx(key, val, noPeekVal);
+                    assert cache.containsKey(key);
 
-                assert cache.containsKey(key);
+                    assert !cache.removex(key, noPeekVal);
+                    assert cache.removex(key, hasPeekVal);
 
-                assert !cache.removex(key, noPeekVal);
-                assert cache.removex(key, hasPeekVal);
-
-                assert !cache.containsKey(key);
+                    assert !cache.containsKey(key);
 
-                assert !cache.putx(key, val, hasPeekVal);
-                assert cache.putx(key, val, noPeekVal);
+                    assert !cache.putx(key, val, hasPeekVal);
+                    assert cache.putx(key, val, noPeekVal);
 
-                assert cache.containsKey(key);
+                    assert cache.containsKey(key);
 
-                tx.commit();
+                    tx.commit();
+                }
 
                 assert cache.containsKey(key);
             }

Reply via email to