http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/GridCacheBinaryObjectsAbstractSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/GridCacheBinaryObjectsAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/GridCacheBinaryObjectsAbstractSelfTest.java index 20b5db8..f3b14b1 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/GridCacheBinaryObjectsAbstractSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/GridCacheBinaryObjectsAbstractSelfTest.java @@ -471,15 +471,11 @@ public abstract class GridCacheBinaryObjectsAbstractSelfTest extends GridCommonA public void testGetAsync() throws Exception { IgniteCache<Integer, TestObject> c = jcache(0); - IgniteCache<Integer, TestObject> cacheAsync = c.withAsync(); - for (int i = 0; i < ENTRY_CNT; i++) c.put(i, new TestObject(i)); for (int i = 0; i < ENTRY_CNT; i++) { - cacheAsync.get(i); - - TestObject obj = cacheAsync.<TestObject>future().get(); + TestObject obj = c.getAsync(i).get(); assertNotNull(obj); @@ -488,12 +484,8 @@ public abstract class GridCacheBinaryObjectsAbstractSelfTest extends GridCommonA IgniteCache<Integer, BinaryObject> kpc = keepBinaryCache(); - IgniteCache<Integer, BinaryObject> cacheBinaryAsync = kpc.withAsync(); - for (int i = 0; i < ENTRY_CNT; i++) { - cacheBinaryAsync.get(i); - - BinaryObject po = cacheBinaryAsync.<BinaryObject>future().get(); + BinaryObject po = kpc.getAsync(i).get(); assertEquals(i, (int)po.field("val")); } @@ -644,18 +636,15 @@ public abstract class GridCacheBinaryObjectsAbstractSelfTest extends GridCommonA return; IgniteCache<Integer, TestObject> c = jcache(0); - IgniteCache<Integer, TestObject> cAsync = c.withAsync(); IgniteCache<Integer, BinaryObject> kbCache = keepBinaryCache(); - IgniteCache<Integer, BinaryObject> kbCacheAsync = kbCache.withAsync(); for (int i = 0; i < ENTRY_CNT; i++) c.put(i, new TestObject(i)); for (int i = 0; i < ENTRY_CNT; i++) { try (Transaction tx = grid(0).transactions().txStart(concurrency, isolation)) { - cAsync.get(i); - TestObject obj = (TestObject)cAsync.future().get(); + TestObject obj = c.getAsync(i).get(); assertEquals(i, obj.val); @@ -665,17 +654,13 @@ public abstract class GridCacheBinaryObjectsAbstractSelfTest extends GridCommonA for (int i = 0; i < ENTRY_CNT; i++) { try (Transaction tx = grid(0).transactions().txStart(concurrency, isolation)) { - kbCacheAsync.get(i); - - BinaryObject val = (BinaryObject)kbCacheAsync.future().get(); + BinaryObject val = kbCache.getAsync(i).get(); assertFalse("Key=" + i, val instanceof BinaryObjectOffheapImpl); assertEquals(i, (int)val.field("val")); - kbCacheAsync.put(i, val); - - kbCacheAsync.future().get(); + kbCache.putAsync(i, val).get(); tx.commit(); } @@ -691,16 +676,12 @@ public abstract class GridCacheBinaryObjectsAbstractSelfTest extends GridCommonA IgniteCache<Integer, TestObject> c = jcache(0); - IgniteCache<Integer, TestObject> cacheAsync = c.withAsync(); - for (int i = 0; i < ENTRY_CNT; i++) c.put(i, new TestObject(i)); for (int i = 0; i < ENTRY_CNT; i++) { try (Transaction tx = grid(0).transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - cacheAsync.get(i); - - TestObject obj = cacheAsync.<TestObject>future().get(); + TestObject obj = c.getAsync(i).get(); assertEquals(i, obj.val); @@ -709,13 +690,10 @@ public abstract class GridCacheBinaryObjectsAbstractSelfTest extends GridCommonA } IgniteCache<Integer, BinaryObject> kpc = keepBinaryCache(); - IgniteCache<Integer, BinaryObject> cacheBinaryAsync = kpc.withAsync(); for (int i = 0; i < ENTRY_CNT; i++) { try (Transaction tx = grid(0).transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - cacheBinaryAsync.get(i); - - BinaryObject po = cacheBinaryAsync.<BinaryObject>future().get(); + BinaryObject po = kpc.getAsync(i).get(); assertEquals(i, (int)po.field("val")); @@ -770,8 +748,6 @@ public abstract class GridCacheBinaryObjectsAbstractSelfTest extends GridCommonA public void testGetAllAsync() throws Exception { IgniteCache<Integer, TestObject> c = jcache(0); - IgniteCache<Integer, TestObject> cacheAsync = c.withAsync(); - for (int i = 0; i < ENTRY_CNT; i++) c.put(i, new TestObject(i)); @@ -781,9 +757,7 @@ public abstract class GridCacheBinaryObjectsAbstractSelfTest extends GridCommonA for (int j = 0; j < 10; j++) keys.add(i++); - cacheAsync.getAll(keys); - - Map<Integer, TestObject> objs = cacheAsync.<Map<Integer, TestObject>>future().get(); + Map<Integer, TestObject> objs = c.getAllAsync(keys).get(); assertEquals(10, objs.size()); @@ -792,7 +766,6 @@ public abstract class GridCacheBinaryObjectsAbstractSelfTest extends GridCommonA } IgniteCache<Integer, BinaryObject> kpc = keepBinaryCache(); - IgniteCache<Integer, BinaryObject> cacheBinaryAsync = kpc.withAsync(); for (int i = 0; i < ENTRY_CNT; ) { Set<Integer> keys = new HashSet<>(); @@ -800,9 +773,7 @@ public abstract class GridCacheBinaryObjectsAbstractSelfTest extends GridCommonA for (int j = 0; j < 10; j++) keys.add(i++); - cacheBinaryAsync.getAll(keys); - - Map<Integer, BinaryObject> objs = cacheBinaryAsync.<Map<Integer, BinaryObject>>future().get(); + Map<Integer, BinaryObject> objs = kpc.getAllAsync(keys).get(); assertEquals(10, objs.size()); @@ -906,7 +877,6 @@ public abstract class GridCacheBinaryObjectsAbstractSelfTest extends GridCommonA return; IgniteCache<Integer, TestObject> c = jcache(0); - IgniteCache<Integer, TestObject> cacheAsync = c.withAsync(); for (int i = 0; i < ENTRY_CNT; i++) c.put(i, new TestObject(i)); @@ -918,9 +888,7 @@ public abstract class GridCacheBinaryObjectsAbstractSelfTest extends GridCommonA keys.add(i++); try (Transaction tx = grid(0).transactions().txStart(concurrency, isolation)) { - cacheAsync.getAll(keys); - - Map<Integer, TestObject> objs = cacheAsync.<Map<Integer, TestObject>>future().get(); + Map<Integer, TestObject> objs = c.getAllAsync(keys).get(); assertEquals(10, objs.size()); @@ -939,12 +907,8 @@ public abstract class GridCacheBinaryObjectsAbstractSelfTest extends GridCommonA for (int j = 0; j < 10; j++) keys.add(i++); - IgniteCache<Integer, BinaryObject> asyncCache = cache.withAsync(); - try (Transaction tx = grid(0).transactions().txStart(concurrency, isolation)) { - asyncCache.getAll(keys); - - Map<Integer, BinaryObject> objs = asyncCache.<Map<Integer, BinaryObject>>future().get(); + Map<Integer, BinaryObject> objs = cache.getAllAsync(keys).get(); assertEquals(10, objs.size()); @@ -1160,13 +1124,8 @@ public abstract class GridCacheBinaryObjectsAbstractSelfTest extends GridCommonA * @throws Exception If failed. */ public void testLoadCacheAsync() throws Exception { - for (int i = 0; i < gridCount(); i++) { - IgniteCache<Object, Object> jcache = jcache(i).withAsync(); - - jcache.loadCache(null); - - jcache.future().get(); - } + for (int i = 0; i < gridCount(); i++) + jcache(i).loadCacheAsync(null).get(); IgniteCache<Integer, TestObject> cache = jcache(0); @@ -1182,15 +1141,13 @@ public abstract class GridCacheBinaryObjectsAbstractSelfTest extends GridCommonA */ public void testLoadCacheFilteredAsync() throws Exception { for (int i = 0; i < gridCount(); i++) { - IgniteCache<Integer, TestObject> c = this.<Integer, TestObject>jcache(i).withAsync(); + IgniteCache<Integer, TestObject> c = jcache(i); - c.loadCache(new P2<Integer, TestObject>() { + c.loadCacheAsync(new P2<Integer, TestObject>() { @Override public boolean apply(Integer key, TestObject val) { return val.val < 3; } - }); - - c.future().get(); + }).get(); } IgniteCache<Integer, TestObject> cache = jcache(0);
http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheAbstractDataStructuresFailoverSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheAbstractDataStructuresFailoverSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheAbstractDataStructuresFailoverSelfTest.java index f6465eb..285ea6e 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheAbstractDataStructuresFailoverSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheAbstractDataStructuresFailoverSelfTest.java @@ -53,6 +53,7 @@ import org.apache.ignite.internal.util.typedef.internal.U; import org.apache.ignite.lang.IgniteBiTuple; import org.apache.ignite.lang.IgniteCallable; import org.apache.ignite.lang.IgniteClosure; +import org.apache.ignite.lang.IgniteFuture; import org.apache.ignite.resources.IgniteInstanceResource; import org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi; import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi; @@ -614,9 +615,7 @@ public abstract class GridCacheAbstractDataStructuresFailoverSelfTest extends Ig IgniteSemaphore semaphore = server.semaphore("sync", 0, true, true); - IgniteCompute compute = client.compute().withAsync(); - - compute.apply(new IgniteClosure<Ignite, Object>() { + IgniteFuture fut = client.compute().applyAsync(new IgniteClosure<Ignite, Object>() { @Override public Object apply(Ignite ignite) { final IgniteLock l = ignite.reentrantLock("lock", true, fair, true); @@ -662,7 +661,7 @@ public abstract class GridCacheAbstractDataStructuresFailoverSelfTest extends Ig for (int i = 0; i < gridCount(); i++) stopGrid(i); - compute.future().get(); + fut.get(); client.close(); } http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheQueueJoinedNodeSelfAbstractTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheQueueJoinedNodeSelfAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheQueueJoinedNodeSelfAbstractTest.java index b664db8..eb8c3c0 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheQueueJoinedNodeSelfAbstractTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheQueueJoinedNodeSelfAbstractTest.java @@ -70,11 +70,9 @@ public abstract class GridCacheQueueJoinedNodeSelfAbstractTest extends IgniteCol PutJob putJob = new PutJob(queueName); - IgniteCompute comp = compute(grid(0).cluster().forLocal()).withAsync(); + IgniteCompute comp = compute(grid(0).cluster().forLocal()); - comp.run(putJob); - - IgniteFuture<?> fut = comp.future(); + IgniteFuture<?> fut = comp.runAsync(putJob); Collection<IgniteFuture<?>> futs = new ArrayList<>(GRID_CNT - 1); @@ -89,11 +87,9 @@ public abstract class GridCacheQueueJoinedNodeSelfAbstractTest extends IgniteCol jobs.add(job); - comp = compute(grid(i).cluster().forLocal()).withAsync(); - - comp.call(job); + comp = compute(grid(i).cluster().forLocal()); - futs.add(comp.future()); + futs.add(comp.callAsync(job)); itemsLeft -= cnt; } http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/IgniteCountDownLatchAbstractSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/IgniteCountDownLatchAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/IgniteCountDownLatchAbstractSelfTest.java index 88966b0..4714acf 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/IgniteCountDownLatchAbstractSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/IgniteCountDownLatchAbstractSelfTest.java @@ -30,7 +30,6 @@ import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicInteger; import org.apache.ignite.Ignite; import org.apache.ignite.IgniteCache; -import org.apache.ignite.IgniteCompute; import org.apache.ignite.IgniteCountDownLatch; import org.apache.ignite.IgniteLogger; import org.apache.ignite.cluster.ClusterGroup; @@ -136,9 +135,7 @@ public abstract class IgniteCountDownLatchAbstractSelfTest extends IgniteAtomics assertEquals(2, latch1.count()); - IgniteCompute comp = grid(0).compute().withAsync(); - - comp.call(new IgniteCallable<Object>() { + IgniteFuture<Object> fut = grid(0).compute().callAsync(new IgniteCallable<Object>() { @IgniteInstanceResource private Ignite ignite; @@ -173,8 +170,6 @@ public abstract class IgniteCountDownLatchAbstractSelfTest extends IgniteAtomics } }); - IgniteFuture<Object> fut = comp.future(); - Thread.sleep(3000); assert latch1.countDown() == 1; http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/IgniteLockAbstractSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/IgniteLockAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/IgniteLockAbstractSelfTest.java index 27e05b9..cccb8ab 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/IgniteLockAbstractSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/IgniteLockAbstractSelfTest.java @@ -36,7 +36,6 @@ import java.util.concurrent.atomic.AtomicReference; import org.apache.ignite.Ignite; import org.apache.ignite.IgniteCache; import org.apache.ignite.IgniteCheckedException; -import org.apache.ignite.IgniteCompute; import org.apache.ignite.IgniteCondition; import org.apache.ignite.IgniteCountDownLatch; import org.apache.ignite.IgniteException; @@ -243,9 +242,7 @@ public abstract class IgniteLockAbstractSelfTest extends IgniteAtomicsAbstractTe lock1.lock(); - IgniteCompute comp = grid(0).compute().withAsync(); - - comp.call(new IgniteCallable<Object>() { + IgniteFuture<Object> fut = grid(0).compute().callAsync(new IgniteCallable<Object>() { @IgniteInstanceResource private Ignite ignite; @@ -282,8 +279,6 @@ public abstract class IgniteLockAbstractSelfTest extends IgniteAtomicsAbstractTe } }); - IgniteFuture<Object> fut = comp.future(); - Thread.sleep(3000); assert lock1.isHeldByCurrentThread(); http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/IgniteSemaphoreAbstractSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/IgniteSemaphoreAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/IgniteSemaphoreAbstractSelfTest.java index 56b260f..c39fdb0 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/IgniteSemaphoreAbstractSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/IgniteSemaphoreAbstractSelfTest.java @@ -28,7 +28,6 @@ import java.util.concurrent.Callable; import org.apache.ignite.Ignite; import org.apache.ignite.IgniteCache; import org.apache.ignite.IgniteCheckedException; -import org.apache.ignite.IgniteCompute; import org.apache.ignite.IgniteLogger; import org.apache.ignite.IgniteSemaphore; import org.apache.ignite.configuration.CacheConfiguration; @@ -225,9 +224,7 @@ public abstract class IgniteSemaphoreAbstractSelfTest extends IgniteAtomicsAbstr assertEquals(-2, semaphore1.availablePermits()); - IgniteCompute comp = grid(0).compute().withAsync(); - - comp.call(new IgniteCallable<Object>() { + IgniteFuture<Object> fut = grid(0).compute().callAsync(new IgniteCallable<Object>() { @IgniteInstanceResource private Ignite ignite; @@ -264,8 +261,6 @@ public abstract class IgniteSemaphoreAbstractSelfTest extends IgniteAtomicsAbstr } }); - IgniteFuture<Object> fut = comp.future(); - Thread.sleep(3000); semaphore1.release(2); http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheAsyncOperationsFailoverAbstractTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheAsyncOperationsFailoverAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheAsyncOperationsFailoverAbstractTest.java index cf49cef..f2ae9ce 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheAsyncOperationsFailoverAbstractTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheAsyncOperationsFailoverAbstractTest.java @@ -111,7 +111,7 @@ public abstract class CacheAsyncOperationsFailoverAbstractTest extends GridCache * @throws Exception If failed. */ public void testAsyncFailover() throws Exception { - IgniteCache<TestKey, TestValue> cache = ignite(0).<TestKey, TestValue>cache(null).withAsync(); + IgniteCache<TestKey, TestValue> cache = ignite(0).cache(null); int ops = cache.getConfiguration(CacheConfiguration.class).getMaxConcurrentAsyncOperations(); @@ -178,9 +178,7 @@ public abstract class CacheAsyncOperationsFailoverAbstractTest extends GridCache for (int k = 0; k < keys; k++) map.put(new TestKey(rnd.nextInt(10_000)), new TestValue(k)); - cache.putAll(map); - - IgniteFuture<?> fut = cache.future(); + IgniteFuture<?> fut = cache.putAllAsync(map); assertNotNull(fut); @@ -227,7 +225,7 @@ public abstract class CacheAsyncOperationsFailoverAbstractTest extends GridCache }); try { - final IgniteCache<TestKey, TestValue> cache = ignite(0).<TestKey, TestValue>cache(null).withAsync(); + final IgniteCache<TestKey, TestValue> cache = ignite(0).cache(null); GridTestUtils.runMultiThreaded(new Callable<Object>() { @Override public Object call() throws Exception { @@ -253,9 +251,7 @@ public abstract class CacheAsyncOperationsFailoverAbstractTest extends GridCache for (int k = 0; k < keys; k++) map.put(new TestKey(rnd.nextInt(10_000)), new TestValue(iter)); - cache.putAll(map); - - IgniteFuture<?> fut = cache.future(); + IgniteFuture<?> fut = cache.putAllAsync(map); assertNotNull(fut); http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheAsyncOperationsTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheAsyncOperationsTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheAsyncOperationsTest.java index 34cbb5b..06baa09 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheAsyncOperationsTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheAsyncOperationsTest.java @@ -122,19 +122,11 @@ public class CacheAsyncOperationsTest extends GridCommonAbstractTest { latch = new CountDownLatch(1); - IgniteCache<Integer, Integer> asyncCache = cache.withAsync(); + IgniteFuture<?> fut1 = cache.putAsync(0, 0); - asyncCache.put(0, 0); + IgniteFuture<?> fut2 = cache.getAndPutAsync(1, 2); - IgniteFuture<?> fut1 = asyncCache.future(); - - asyncCache.getAndPut(1, 2); - - IgniteFuture<?> fut2 = asyncCache.future(); - - asyncCache.getAndPut(1, 3); - - IgniteFuture<?> fut3 = asyncCache.future(); + IgniteFuture<?> fut3 = cache.getAndPutAsync(1, 3); assertFalse(fut1.isDone()); assertFalse(fut2.isDone()); @@ -166,23 +158,13 @@ public class CacheAsyncOperationsTest extends GridCommonAbstractTest { latch = new CountDownLatch(1); - IgniteCache<Integer, Integer> asyncCache = cache.withAsync(); - - asyncCache.put(0, 0); - - IgniteFuture<?> fut1 = asyncCache.future(); - - asyncCache.put(0, 0); - - IgniteFuture<?> fut2 = asyncCache.future(); - - asyncCache.getAndPut(1, 2); + IgniteFuture<?> fut1 = cache.putAsync(0, 0); - IgniteFuture<?> fut3 = asyncCache.future(); + IgniteFuture<?> fut2 = cache.putAsync(0, 0); - asyncCache.put(0, 0); + IgniteFuture<?> fut3 = cache.getAndPutAsync(1, 2); - IgniteFuture<?> fut4 = asyncCache.future(); + IgniteFuture<?> fut4 = cache.putAsync(0, 0); assertFalse(fut1.isDone()); assertFalse(fut2.isDone()); http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CachePutAllFailoverAbstractTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CachePutAllFailoverAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CachePutAllFailoverAbstractTest.java index 2d74e21..1e3f081 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CachePutAllFailoverAbstractTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CachePutAllFailoverAbstractTest.java @@ -142,9 +142,7 @@ public abstract class CachePutAllFailoverAbstractTest extends GridCacheAbstractS }); try { - IgniteCache<TestKey, TestValue> cache0 = ignite(0).cache(null); - - final IgniteCache<TestKey, TestValue> cache = test == Test.PUT_ALL_ASYNC ? cache0.withAsync() : cache0; + final IgniteCache<TestKey, TestValue> cache = ignite(0).cache(null); GridTestUtils.runMultiThreaded(new Callable<Object>() { @Override public Object call() throws Exception { @@ -184,9 +182,7 @@ public abstract class CachePutAllFailoverAbstractTest extends GridCacheAbstractS for (int k = 0; k < 100; k++) map.put(new TestKey(rnd.nextInt(200)), new TestValue(iter)); - cache.putAll(map); - - IgniteFuture<?> fut = cache.future(); + IgniteFuture<?> fut = cache.putAllAsync(map); assertNotNull(fut); http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheAbstractJobExecutionTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheAbstractJobExecutionTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheAbstractJobExecutionTest.java index 1769e14..6a61fbb 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheAbstractJobExecutionTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheAbstractJobExecutionTest.java @@ -22,13 +22,12 @@ import java.util.LinkedList; import java.util.concurrent.atomic.AtomicInteger; import org.apache.ignite.Ignite; import org.apache.ignite.IgniteCache; -import org.apache.ignite.IgniteCompute; -import org.apache.ignite.compute.ComputeTaskFuture; import org.apache.ignite.configuration.IgniteConfiguration; import org.apache.ignite.internal.IgniteEx; import org.apache.ignite.internal.processors.cache.GridCacheAdapter; import org.apache.ignite.internal.util.typedef.CX1; import org.apache.ignite.internal.util.typedef.X; +import org.apache.ignite.lang.IgniteFuture; import org.apache.ignite.resources.IgniteInstanceResource; import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi; import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder; @@ -132,16 +131,14 @@ public abstract class GridCacheAbstractJobExecutionTest extends GridCommonAbstra Ignite ignite = grid(0); - Collection<ComputeTaskFuture<?>> futs = new LinkedList<>(); + Collection<IgniteFuture<?>> futs = new LinkedList<>(); final String key = "TestKey"; info("Primary node for test key: " + grid(0).affinity(null).mapKeyToNode(key)); - IgniteCompute comp = ignite.compute().withAsync(); - for (int i = 0; i < jobCnt; i++) { - comp.apply(new CX1<Integer, Void>() { + futs.add(ignite.compute().applyAsync(new CX1<Integer, Void>() { @IgniteInstanceResource private Ignite ignite; @@ -168,12 +165,10 @@ public abstract class GridCacheAbstractJobExecutionTest extends GridCommonAbstra return null; } - }, i); - - futs.add(comp.future()); + }, i)); } - for (ComputeTaskFuture<?> fut : futs) + for (IgniteFuture<?> fut : futs) fut.get(); // Wait for completion. for (int i = 0; i < GRID_CNT; i++) { http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheBasicOpAbstractTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheBasicOpAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheBasicOpAbstractTest.java index 6085fca..cd7e513 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheBasicOpAbstractTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheBasicOpAbstractTest.java @@ -181,29 +181,20 @@ public abstract class GridCacheBasicOpAbstractTest extends GridCommonAbstractTes try { IgniteCache<String, String> cache1 = ignite1.cache(null); - IgniteCache<String, String> cache1Async = cache1.withAsync(); IgniteCache<String, String> cache2 = ignite2.cache(null); - IgniteCache<String, String> cache2Async = cache2.withAsync(); IgniteCache<String, String> cache3 = ignite3.cache(null); - IgniteCache<String, String> cache3Async = cache3.withAsync(); ignite1.events().localListen(lsnr, EVT_CACHE_OBJECT_PUT, EVT_CACHE_OBJECT_REMOVED); ignite2.events().localListen(lsnr, EVT_CACHE_OBJECT_PUT, EVT_CACHE_OBJECT_REMOVED); ignite3.events().localListen(lsnr, EVT_CACHE_OBJECT_PUT, EVT_CACHE_OBJECT_REMOVED); - cache1Async.get("async1"); - - IgniteFuture<String> f1 = cache1Async.future(); + IgniteFuture<String> f1 = cache1.getAsync("async1"); assert f1.get() == null; - cache1Async.put("async1", "asyncval1"); - - cache1Async.future().get(); + cache1.putAsync("async1", "asyncval1").get(); - cache1Async.get("async1"); - - f1 = cache1Async.future(); + f1 = cache1.getAsync("async1"); String v1 = f1.get(); @@ -212,13 +203,10 @@ public abstract class GridCacheBasicOpAbstractTest extends GridCommonAbstractTes assert latch.await(5, SECONDS); - cache2Async.get("async1"); - - IgniteFuture<String> f2 = cache2Async.future(); + IgniteFuture<String> f2 = cache2.getAsync("async1"); - cache3Async.get("async1"); + IgniteFuture<String> f3 = cache3.getAsync("async1"); - IgniteFuture<String> f3 = cache3Async.future(); String v2 = f2.get(); String v3 = f3.get(); @@ -231,25 +219,17 @@ public abstract class GridCacheBasicOpAbstractTest extends GridCommonAbstractTes lsnr.setLatch(latch = new CountDownLatch(3)); - cache2Async.getAndRemove("async1"); - - f2 = cache2Async.future(); + f2 = cache2.getAndRemoveAsync("async1"); assert "asyncval1".equals(f2.get()); assert latch.await(5, SECONDS); - cache1Async.get("async1"); - - f1 = cache1Async.future(); - - cache2Async.get("async1"); - - f2 = cache2Async.future(); + f1 = cache1.getAsync("async1"); - cache3Async.get("async1"); + f2 = cache2.getAsync("async1"); - f3 = cache3Async.future(); + f3 = cache3.getAsync("async1"); v1 = f1.get(); v2 = f2.get(); http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/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 ee63ba9..8d916a7 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 @@ -311,8 +311,6 @@ public abstract class GridCacheEventAbstractTest extends GridCacheAbstractSelfTe public void testGetPutRemoveAsync() throws Exception { runTest(new TestCacheRunnable() { @Override public void run(IgniteCache<String, Integer> cache) throws IgniteCheckedException { - IgniteCache<String, Integer> asyncCache = cache.withAsync(); - Map.Entry<String, Integer> e = F.first(pairs(1).entrySet()); assert e != null; @@ -320,19 +318,13 @@ public abstract class GridCacheEventAbstractTest extends GridCacheAbstractSelfTe String key = e.getKey(); Integer val = e.getValue(); - asyncCache.getAndPut(key, val); - - assert asyncCache.future().get() == null; + assert cache.getAndPutAsync(key, val).get() == null; assert cache.containsKey(key); - asyncCache.get(key); - - assert val.equals(asyncCache.future().get()); + assert val.equals(cache.getAsync(key).get()); - asyncCache.getAndRemove(key); - - assert val.equals(asyncCache.future().get()); + assert val.equals(cache.getAndRemoveAsync(key).get()); assert !cache.containsKey(key); } @@ -345,8 +337,6 @@ public abstract class GridCacheEventAbstractTest extends GridCacheAbstractSelfTe public void testGetPutRemoveAsyncTx1() throws Exception { runTest(new TestCacheRunnable() { @Override public void run(IgniteCache<String, Integer> cache) throws IgniteCheckedException { - IgniteCache<String, Integer> asyncCache = cache.withAsync(); - Map.Entry<String, Integer> e = F.first(pairs(1).entrySet()); assert e != null; @@ -356,19 +346,13 @@ public abstract class GridCacheEventAbstractTest extends GridCacheAbstractSelfTe Transaction tx = cache.unwrap(Ignite.class).transactions().txStart(); - asyncCache.getAndPut(key, val); - - assert asyncCache.future().get() == null; + assert cache.getAndPutAsync(key, val).get() == null; assert cache.containsKey(key); - asyncCache.get(key); + assert val.equals(cache.getAsync(key).get()); - assert val.equals(asyncCache.future().get()); - - asyncCache.getAndRemove(key); - - assert val.equals(asyncCache.future().get()); + assert val.equals(cache.getAndRemoveAsync(key).get()); assert !cache.containsKey(key); @@ -385,8 +369,6 @@ public abstract class GridCacheEventAbstractTest extends GridCacheAbstractSelfTe public void testGetPutRemoveAsyncTx2() throws Exception { runTest(new TestCacheRunnable() { @Override public void run(IgniteCache<String, Integer> cache) throws IgniteCheckedException { - IgniteCache<String, Integer> asyncCache = cache.withAsync(); - Map.Entry<String, Integer> e = F.first(pairs(1).entrySet()); assert e != null; @@ -396,25 +378,17 @@ public abstract class GridCacheEventAbstractTest extends GridCacheAbstractSelfTe Transaction tx = cache.unwrap(Ignite.class).transactions().txStart(); - asyncCache.getAndPut(key, val); - - assert asyncCache.future().get() == null; + assert cache.getAndPutAsync(key, val).get() == null; assert cache.containsKey(key); - asyncCache.get(key); - - assert val.equals(asyncCache.future().get()); - - asyncCache.getAndRemove(key); + assert val.equals(cache.getAsync(key).get()); - assert val.equals(asyncCache.future().get()); + assert val.equals(cache.getAndRemoveAsync(key).get()); assert !cache.containsKey(key); - asyncCache.getAndPut(key, val); - - assert asyncCache.future().get() == null; + assert cache.getAndPutAsync(key, val).get() == null; assert cache.containsKey(key); @@ -588,8 +562,6 @@ public abstract class GridCacheEventAbstractTest extends GridCacheAbstractSelfTe public void testPutIfAbsentAsync() throws Exception { runTest(new TestCacheRunnable() { @Override public void run(IgniteCache<String, Integer> cache) throws IgniteCheckedException { - IgniteCache<String, Integer> asyncCache = cache.withAsync(); - Iterator<Map.Entry<String, Integer>> iter = pairs(2).entrySet().iterator(); Map.Entry<String, Integer> e = iter.next(); @@ -597,13 +569,9 @@ public abstract class GridCacheEventAbstractTest extends GridCacheAbstractSelfTe String key = e.getKey(); Integer val = e.getValue(); - asyncCache.getAndPutIfAbsent(key, val); - - assert asyncCache.future().get() == null; + assert cache.getAndPutIfAbsentAsync(key, val).get() == null; - asyncCache.getAndPutIfAbsent(key, val); - - assert val.equals(asyncCache.future().get()); + assert val.equals(cache.getAndPutIfAbsentAsync(key, val).get()); assert cache.containsKey(key); @@ -612,13 +580,9 @@ public abstract class GridCacheEventAbstractTest extends GridCacheAbstractSelfTe key = e.getKey(); val = e.getValue(); - asyncCache.putIfAbsent(key, val); - - assert ((Boolean)asyncCache.future().get()).booleanValue(); - - asyncCache.putIfAbsent(key, val); + assert cache.putIfAbsentAsync(key, val).get().booleanValue(); - assert !((Boolean)asyncCache.future().get()).booleanValue(); + assert !cache.putIfAbsentAsync(key, val).get().booleanValue(); assert cache.containsKey(key); } @@ -634,8 +598,6 @@ public abstract class GridCacheEventAbstractTest extends GridCacheAbstractSelfTe runTest(new TestCacheRunnable() { @Override public void run(IgniteCache<String, Integer> cache) throws IgniteCheckedException { - IgniteCache<String, Integer> asyncCache = cache.withAsync(); - Iterator<Map.Entry<String, Integer>> iter = pairs(2).entrySet().iterator(); // Optimistic transaction. @@ -645,13 +607,9 @@ public abstract class GridCacheEventAbstractTest extends GridCacheAbstractSelfTe String key = e.getKey(); Integer val = e.getValue(); - asyncCache.getAndPutIfAbsent(key, val); - - assert asyncCache.future().get() == null; - - asyncCache.getAndPutIfAbsent(key, val); + assert cache.getAndPutIfAbsentAsync(key, val).get() == null; - assert val.equals(asyncCache.future().get()); + assert val.equals(cache.getAndPutIfAbsentAsync(key, val).get()); assert cache.containsKey(key); @@ -660,13 +618,9 @@ public abstract class GridCacheEventAbstractTest extends GridCacheAbstractSelfTe key = e.getKey(); val = e.getValue(); - asyncCache.putIfAbsent(key, val); - - assert ((Boolean)asyncCache.future().get()).booleanValue(); - - asyncCache.putIfAbsent(key, val); + assert cache.putIfAbsentAsync(key, val).get().booleanValue(); - assert !((Boolean)asyncCache.future().get()).booleanValue(); + assert !cache.putIfAbsentAsync(key, val).get().booleanValue(); assert cache.containsKey(key); http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheMultiNodeAbstractTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheMultiNodeAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheMultiNodeAbstractTest.java index 93dabb8..67327be 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheMultiNodeAbstractTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheMultiNodeAbstractTest.java @@ -66,15 +66,6 @@ public abstract class GridCacheMultiNodeAbstractTest extends GridCommonAbstractT /** Cache 3. */ private static IgniteCache<Integer, String> cache3; - /** Cache 1. */ - private static IgniteCache<Integer, String> cache1Async; - - /** Cache 2. */ - private static IgniteCache<Integer, String> cache2Async; - - /** Cache 3. */ - private static IgniteCache<Integer, String> cache3Async; - /** */ private static TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true); @@ -103,10 +94,6 @@ public abstract class GridCacheMultiNodeAbstractTest extends GridCommonAbstractT cache1 = ignite1.cache(null); cache2 = ignite2.cache(null); cache3 = ignite3.cache(null); - - cache1Async = cache1.withAsync(); - cache2Async = cache2.withAsync(); - cache3Async = cache3.withAsync(); } /** {@inheritDoc} */ @@ -297,17 +284,11 @@ public abstract class GridCacheMultiNodeAbstractTest extends GridCommonAbstractT addListener(ignite2, lsnr); addListener(ignite3, lsnr); - cache1Async.getAndPut(2, "val1"); - - IgniteFuture<String> f1 = cache1Async.future(); - - cache2Async.getAndPut(2, "val2"); - - IgniteFuture<String> f2 = cache2Async.future(); + IgniteFuture<String> f1 = cache1.getAndPutAsync(2, "val1"); - cache3Async.getAndPut(2, "val3"); + IgniteFuture<String> f2 = cache2.getAndPutAsync(2, "val2"); - IgniteFuture<String> f3 = cache3Async.future(); + IgniteFuture<String> f3 = cache3.getAndPutAsync(2, "val3"); String v1 = f1.get(20000); http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteBinaryMetadataUpdateChangingTopologySelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteBinaryMetadataUpdateChangingTopologySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteBinaryMetadataUpdateChangingTopologySelfTest.java index b07c437..68bce5e 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteBinaryMetadataUpdateChangingTopologySelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteBinaryMetadataUpdateChangingTopologySelfTest.java @@ -40,6 +40,7 @@ import org.apache.ignite.internal.managers.communication.GridIoMessage; import org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxPrepareResponse; import org.apache.ignite.internal.util.typedef.F; import org.apache.ignite.internal.util.typedef.T2; +import org.apache.ignite.lang.IgniteFuture; import org.apache.ignite.lang.IgniteInClosure; import org.apache.ignite.plugin.extensions.communication.Message; import org.apache.ignite.resources.LoggerResource; @@ -104,9 +105,9 @@ public class IgniteBinaryMetadataUpdateChangingTopologySelfTest extends GridComm spi.blockMessages(GridNearTxPrepareResponse.class, ignite(0).cluster().localNode().id()); - IgniteCache<Object, Object> cache = ignite(0).cache("cache").withAsync(); + IgniteCache<Object, Object> cache = ignite(0).cache("cache"); - cache.putAll(F.asMap(key1, "val1", key2, new TestValue1())); + IgniteFuture futPutAll = cache.putAllAsync(F.asMap(key1, "val1", key2, new TestValue1())); try { Thread.sleep(500); @@ -123,7 +124,7 @@ public class IgniteBinaryMetadataUpdateChangingTopologySelfTest extends GridComm spi.stopBlock(); - cache.future().get(); + futPutAll.get(); fut.get(); } @@ -143,9 +144,9 @@ public class IgniteBinaryMetadataUpdateChangingTopologySelfTest extends GridComm spi.blockMessages(GridNearTxPrepareResponse.class, ignite(0).cluster().localNode().id()); - IgniteCache<Object, Object> cache = ignite(0).cache("cache").withAsync(); + IgniteCache<Object, Object> cache = ignite(0).cache("cache"); - cache.invokeAll(F.asSet(key1, key2), new TestEntryProcessor()); + IgniteFuture futInvokeAll = cache.invokeAllAsync(F.asSet(key1, key2), new TestEntryProcessor()); try { Thread.sleep(500); @@ -162,7 +163,7 @@ public class IgniteBinaryMetadataUpdateChangingTopologySelfTest extends GridComm spi.stopBlock(); - cache.future().get(); + futInvokeAll.get(); fut.get(); } http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheConnectionRecoveryTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheConnectionRecoveryTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheConnectionRecoveryTest.java index 450ab9a..7c454e6 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheConnectionRecoveryTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheConnectionRecoveryTest.java @@ -122,18 +122,16 @@ public class IgniteCacheConnectionRecoveryTest extends GridCommonAbstractTest { Thread.currentThread().setName("test-thread-" + idx0 + "-" + node.name()); - IgniteCache cache1 = node.cache("cache1").withAsync(); - IgniteCache cache2 = node.cache("cache2").withAsync(); + IgniteCache cache1 = node.cache("cache1"); + IgniteCache cache2 = node.cache("cache2"); int iter = 0; while (U.currentTimeMillis() < stopTime) { try { - cache1.putAll(data); - cache1.future().get(15, SECONDS); + cache1.putAllAsync(data).get(15, SECONDS); - cache2.putAll(data); - cache2.future().get(15, SECONDS); + cache2.putAllAsync(data).get(15, SECONDS); CyclicBarrier b = barrierRef.get(); http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheMessageRecoveryIdleConnectionTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheMessageRecoveryIdleConnectionTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheMessageRecoveryIdleConnectionTest.java index c47e1e1..10bb3c1 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheMessageRecoveryIdleConnectionTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheMessageRecoveryIdleConnectionTest.java @@ -113,7 +113,7 @@ public class IgniteCacheMessageRecoveryIdleConnectionTest extends GridCommonAbst ccfg.setCacheMode(REPLICATED); ccfg.setWriteSynchronizationMode(FULL_SYNC); - IgniteCache<Object, Object> cache = ignite(0).createCache(ccfg).withAsync(); + IgniteCache<Object, Object> cache = ignite(0).createCache(ccfg); try { ThreadLocalRandom rnd = ThreadLocalRandom.current(); @@ -126,9 +126,7 @@ public class IgniteCacheMessageRecoveryIdleConnectionTest extends GridCommonAbst if (iter++ % 50 == 0) log.info("Iteration: " + iter); - cache.put(iter, 1); - - IgniteFuture<?> fut = cache.future(); + IgniteFuture<?> fut = cache.putAsync(iter, 1); try { fut.get(10_000); http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxPessimisticOriginatingNodeFailureAbstractSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxPessimisticOriginatingNodeFailureAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxPessimisticOriginatingNodeFailureAbstractSelfTest.java index 4997b20..13772d5 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxPessimisticOriginatingNodeFailureAbstractSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxPessimisticOriginatingNodeFailureAbstractSelfTest.java @@ -204,11 +204,7 @@ public abstract class IgniteTxPessimisticOriginatingNodeFailureAbstractSelfTest info("Before commitAsync"); - tx = (Transaction)tx.withAsync(); - - tx.commit(); - - IgniteFuture<Transaction> fut = tx.future(); + IgniteFuture<?> fut = tx.commitAsync(); info("Got future for commitAsync()."); http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheGlobalLoadTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheGlobalLoadTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheGlobalLoadTest.java index aa4f5bd..82823a9 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheGlobalLoadTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheGlobalLoadTest.java @@ -73,21 +73,29 @@ public class GridCacheGlobalLoadTest extends IgniteCacheAbstractTest { * @throws Exception If failed. */ public void testLoadCache() throws Exception { - loadCache(false); + loadCache(false, false); + } + + /** + * @throws Exception If failed. + */ + public void testLoadCacheAsyncOld() throws Exception { + loadCache(true, true); } /** * @throws Exception If failed. */ public void testLoadCacheAsync() throws Exception { - loadCache(true); + loadCache(true, false); } /** * @param async If {@code true} uses asynchronous method. + * @param oldAsyncApi Flag to use old async API. * @throws Exception If failed. */ - private void loadCache(boolean async) throws Exception { + private void loadCache(boolean async, boolean oldAsyncApi) throws Exception { IgniteCache<Integer, Integer> cache = jcache(); IgniteCache<Integer, Integer> asyncCache = cache.withAsync(); @@ -97,9 +105,12 @@ public class GridCacheGlobalLoadTest extends IgniteCacheAbstractTest { map = new ConcurrentHashMap8<>(); if (async) { - asyncCache.loadCache(null, 1, 2, 3); + if (oldAsyncApi) { + asyncCache.loadCache(null, 1, 2, 3); - asyncCache.future().get(); + asyncCache.future().get(); + } else + cache.loadCacheAsync(null, 1, 2, 3).get(); } else cache.loadCache(null, 1, 2, 3); http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheTxNodeFailureSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheTxNodeFailureSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheTxNodeFailureSelfTest.java index d8120ac..1371612 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheTxNodeFailureSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheTxNodeFailureSelfTest.java @@ -237,15 +237,11 @@ public class GridCacheTxNodeFailureSelfTest extends GridCommonAbstractTest { try (Transaction tx = ignite.transactions().txStart(conc, REPEATABLE_READ)) { cache.put(key, key); - Transaction asyncTx = (Transaction)tx.withAsync(); - - asyncTx.commit(); + IgniteFuture<?> fut = tx.commitAsync(); commitLatch.countDown(); try { - IgniteFuture<Object> fut = asyncTx.future(); - fut.get(); if (!commit) { @@ -266,16 +262,14 @@ public class GridCacheTxNodeFailureSelfTest extends GridCommonAbstractTest { } } else { - IgniteCache<Object, Object> cache0 = cache.withAsync(); - - cache0.put(key, key); + IgniteFuture fut = cache.putAsync(key, key); Thread.sleep(1000); commitLatch.countDown(); try { - cache0.future().get(); + fut.get(); if (!commit) { error("Transaction has been committed"); http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCachePutRetryAbstractSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCachePutRetryAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCachePutRetryAbstractSelfTest.java index 2971f81..e42ddcf 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCachePutRetryAbstractSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCachePutRetryAbstractSelfTest.java @@ -371,22 +371,14 @@ public abstract class IgniteCachePutRetryAbstractSelfTest extends GridCommonAbst } case PUT_ASYNC: { - IgniteCache<Integer, Integer> cache0 = cache.withAsync(); - while (System.currentTimeMillis() < stopTime) { Integer val = ++iter; - for (int i = 0; i < keysCnt; i++) { - cache0.put(i, val); - - cache0.future().get(); - } - - for (int i = 0; i < keysCnt; i++) { - cache0.get(i); + for (int i = 0; i < keysCnt; i++) + cache.putAsync(i, val).get(); - assertEquals(val, cache0.future().get()); - } + for (int i = 0; i < keysCnt; i++) + assertEquals(val, cache.getAsync(i).get()); } break; @@ -556,19 +548,13 @@ public abstract class IgniteCachePutRetryAbstractSelfTest extends GridCommonAbst IgniteCache<Object, Object> cache = ignite(0).cache(null).withNoRetries(); - if (async) - cache = cache.withAsync(); - long stopTime = System.currentTimeMillis() + 60_000; while (System.currentTimeMillis() < stopTime) { for (int i = 0; i < keysCnt; i++) { try { - if (async) { - cache.put(i, i); - - cache.future().get(); - } + if (async) + cache.putAsync(i, i).get(); else cache.put(i, i); } http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/IgniteCacheAtomicProtocolTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/IgniteCacheAtomicProtocolTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/IgniteCacheAtomicProtocolTest.java index 6d90d0e..eda030c 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/IgniteCacheAtomicProtocolTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/IgniteCacheAtomicProtocolTest.java @@ -167,7 +167,6 @@ public class IgniteCacheAtomicProtocolTest extends GridCommonAbstractTest { Ignite client = startGrid(4); IgniteCache<Integer, Integer> nearCache = client.cache(TEST_CACHE); - IgniteCache<Integer, Integer> nearAsyncCache = nearCache.withAsync(); if (!blockRebalance) awaitPartitionMapExchange(); @@ -196,9 +195,7 @@ public class IgniteCacheAtomicProtocolTest extends GridCommonAbstractTest { log.info("Start put [key1=" + key1 + ", key2=" + key2 + ']'); - nearAsyncCache.putAll(map); - - IgniteFuture<?> fut = nearAsyncCache.future(); + IgniteFuture<?> fut = nearCache.putAllAsync(map); U.sleep(500); @@ -244,7 +241,6 @@ public class IgniteCacheAtomicProtocolTest extends GridCommonAbstractTest { Ignite client = startGrid(4); IgniteCache<Integer, Integer> nearCache = client.cache(TEST_CACHE); - IgniteCache<Integer, Integer> nearAsyncCache = nearCache.withAsync(); if (!blockRebalance) awaitPartitionMapExchange(); @@ -264,9 +260,7 @@ public class IgniteCacheAtomicProtocolTest extends GridCommonAbstractTest { log.info("Start put [map=" + map + ']'); - nearAsyncCache.putAll(map); - - IgniteFuture<?> fut = nearAsyncCache.future(); + IgniteFuture<?> fut = nearCache.putAllAsync(map); U.sleep(500); @@ -308,7 +302,6 @@ public class IgniteCacheAtomicProtocolTest extends GridCommonAbstractTest { Ignite client = startGrid(4); IgniteCache<Integer, Integer> nearCache = client.cache(TEST_CACHE); - IgniteCache<Integer, Integer> nearAsyncCache = nearCache.withAsync(); if (!blockRebalance) awaitPartitionMapExchange(); @@ -323,9 +316,7 @@ public class IgniteCacheAtomicProtocolTest extends GridCommonAbstractTest { log.info("Start put [key=" + key + ']'); - nearAsyncCache.put(key, key); - - IgniteFuture<?> fut = nearAsyncCache.future(); + IgniteFuture<?> fut = nearCache.putAsync(key, key); U.sleep(500); @@ -438,7 +429,6 @@ public class IgniteCacheAtomicProtocolTest extends GridCommonAbstractTest { client = false; final IgniteCache<Integer, Integer> nearCache = clientNode.createCache(cacheConfiguration(1, PRIMARY_SYNC)); - IgniteCache<Integer, Integer> nearAsyncCache = nearCache.withAsync(); awaitPartitionMapExchange(); @@ -449,9 +439,7 @@ public class IgniteCacheAtomicProtocolTest extends GridCommonAbstractTest { testSpi(srv0).blockMessages(GridDhtAtomicSingleUpdateRequest.class, srv1.name()); - nearAsyncCache.put(key, key); - - IgniteFuture<?> fut = nearAsyncCache.future(); + IgniteFuture<?> fut = nearCache.putAsync(key, key); fut.get(5, TimeUnit.SECONDS); @@ -481,7 +469,6 @@ public class IgniteCacheAtomicProtocolTest extends GridCommonAbstractTest { Ignite clientNode = startGrid(2); final IgniteCache<Integer, Integer> nearCache = clientNode.createCache(cacheConfiguration(1, FULL_SYNC)); - IgniteCache<Integer, Integer> nearAsyncCache = nearCache.withAsync(); awaitPartitionMapExchange(); @@ -490,7 +477,7 @@ public class IgniteCacheAtomicProtocolTest extends GridCommonAbstractTest { final Integer key = primaryKey(srv0.cache(TEST_CACHE)); - nearAsyncCache.put(key, key); + nearCache.putAsync(key, key); testSpi(srv1).blockMessages(GridDhtAtomicNearResponse.class, clientNode.name()); @@ -521,7 +508,6 @@ public class IgniteCacheAtomicProtocolTest extends GridCommonAbstractTest { Ignite clientNode = startGrid(SRVS); final IgniteCache<Integer, Integer> nearCache = clientNode.createCache(cacheConfiguration(1, FULL_SYNC)); - IgniteCache<Integer, Integer> nearAsyncCache = nearCache.withAsync(); awaitPartitionMapExchange(); @@ -533,7 +519,7 @@ public class IgniteCacheAtomicProtocolTest extends GridCommonAbstractTest { for (int i = 0; i < 100; i++) map.put(i, i); - nearAsyncCache.putAll(map); + nearCache.putAllAsync(map); boolean wait = GridTestUtils.waitForCondition(new GridAbsPredicate() { @Override public boolean apply() { @@ -678,7 +664,6 @@ public class IgniteCacheAtomicProtocolTest extends GridCommonAbstractTest { Ignite client = startGrid(4); IgniteCache<Integer, Integer> nearCache = client.cache(TEST_CACHE); - IgniteCache<Integer, Integer> nearAsyncCache = nearCache.withAsync(); testSpi(ignite(0)).blockMessages(new IgnitePredicate<GridIoMessage>() { @Override public boolean apply(GridIoMessage msg) { @@ -690,8 +675,7 @@ public class IgniteCacheAtomicProtocolTest extends GridCommonAbstractTest { log.info("Start put [key=" + key + ']'); - nearAsyncCache.put(key, key); - IgniteFuture<?> fut = nearAsyncCache.future(); + IgniteFuture<?> fut = nearCache.putAsync(key, key); U.sleep(500); @@ -735,7 +719,6 @@ public class IgniteCacheAtomicProtocolTest extends GridCommonAbstractTest { Ignite client = startGrid(4); IgniteCache<Integer, Integer> nearCache = client.cache(TEST_CACHE); - IgniteCache<Integer, Integer> nearAsyncCache = nearCache.withAsync(); if (fail0) { testSpi(ignite(0)).blockMessages(new IgnitePredicate<GridIoMessage>() { @@ -761,8 +744,7 @@ public class IgniteCacheAtomicProtocolTest extends GridCommonAbstractTest { map.put(key1, 10); map.put(key2, 20); - nearAsyncCache.putAll(map); - IgniteFuture<?> fut = nearAsyncCache.future(); + IgniteFuture<?> fut = nearCache.putAllAsync(map); U.sleep(500); http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearOnlyMultiNodeFullApiSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearOnlyMultiNodeFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearOnlyMultiNodeFullApiSelfTest.java index 23fbf2f..5d2ec39 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearOnlyMultiNodeFullApiSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearOnlyMultiNodeFullApiSelfTest.java @@ -517,7 +517,7 @@ public class GridCacheNearOnlyMultiNodeFullApiSelfTest extends GridCachePartitio * @param async If {@code true} uses async method. * @throws Exception If failed. */ - @Override protected void globalClearAll(boolean async) throws Exception { + @Override protected void globalClearAll(boolean async, boolean oldAsync) throws Exception { // Save entries only on their primary nodes. If we didn't do so, clearLocally() will not remove all entries // because some of them were blocked due to having readers. for (int i = 0; i < gridCount(); i++) { @@ -528,11 +528,14 @@ public class GridCacheNearOnlyMultiNodeFullApiSelfTest extends GridCachePartitio } if (async) { - IgniteCache<String, Integer> asyncCache = jcache(nearIdx).withAsync(); + if (oldAsync) { + IgniteCache<String, Integer> asyncCache = jcache(nearIdx).withAsync(); - asyncCache.clear(); + asyncCache.clear(); - asyncCache.future().get(); + asyncCache.future().get(); + } else + jcache(nearIdx).clearAsync().get(); } else jcache(nearIdx).clear(); http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedLoadCacheSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedLoadCacheSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedLoadCacheSelfTest.java index c6bb85e..69310a7 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedLoadCacheSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedLoadCacheSelfTest.java @@ -98,13 +98,8 @@ public class GridCachePartitionedLoadCacheSelfTest extends GridCommonAbstractTes IgniteCache<Integer, String> cache = jcache(0); - if (async) { - IgniteCache<Integer, String> asyncCache = cache.withAsync(); - - asyncCache.localLoadCache(null, PUT_CNT); - - asyncCache.future().get(); - } + if (async) + cache.localLoadCacheAsync(null, PUT_CNT).get(); else cache.localLoadCache(null, PUT_CNT); http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheEmptyEntriesAbstractSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheEmptyEntriesAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheEmptyEntriesAbstractSelfTest.java index e066764..0c14fb0 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheEmptyEntriesAbstractSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheEmptyEntriesAbstractSelfTest.java @@ -204,17 +204,11 @@ public abstract class GridCacheEmptyEntriesAbstractSelfTest extends GridCommonAb private void checkImplicitTx(IgniteCache<String, String> cache) throws Exception { assertNull(cache.get("key1")); - IgniteCache<String, String> asyncCache = cache.withAsync(); - - asyncCache.get("key2"); - - assertNull(asyncCache.future().get()); + assertNull(cache.getAsync("key2").get()); assertTrue(cache.getAll(F.asSet("key3", "key4")).isEmpty()); - asyncCache.getAll(F.asSet("key5", "key6")); - - assertTrue(((Map)asyncCache.future().get()).isEmpty()); + assertTrue(((Map)cache.getAllAsync(F.asSet("key5", "key6")).get()).isEmpty()); cache.put("key7", "key7"); cache.remove("key7", "key7"); @@ -226,12 +220,11 @@ public abstract class GridCacheEmptyEntriesAbstractSelfTest extends GridCommonAb /** * Checks that gets work for implicit txs. * + * @param ignite Ignite instance. * @param cache Cache to test. * @throws Exception If failed. */ private void checkExplicitTx(Ignite ignite, IgniteCache<String, String> cache) throws Exception { - IgniteCache<String, String> asyncCache = cache.withAsync(); - Transaction tx = ignite.transactions().txStart(); try { @@ -246,9 +239,7 @@ public abstract class GridCacheEmptyEntriesAbstractSelfTest extends GridCommonAb tx = ignite.transactions().txStart(); try { - asyncCache.get("key2"); - - assertNull(asyncCache.future().get()); + assertNull(cache.getAsync("key2").get()); tx.commit(); } @@ -270,9 +261,7 @@ public abstract class GridCacheEmptyEntriesAbstractSelfTest extends GridCommonAb tx = ignite.transactions().txStart(); try { - asyncCache.getAll(F.asSet("key5", "key6")); - - assertTrue(((Map)asyncCache.future().get()).isEmpty()); + assertTrue(((Map)cache.getAllAsync(F.asSet("key5", "key6")).get()).isEmpty()); tx.commit(); } http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/GridCacheContinuousQueryConcurrentTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/GridCacheContinuousQueryConcurrentTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/GridCacheContinuousQueryConcurrentTest.java index 586d1595..26574f1 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/GridCacheContinuousQueryConcurrentTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/GridCacheContinuousQueryConcurrentTest.java @@ -345,11 +345,8 @@ public class GridCacheContinuousQueryConcurrentTest extends GridCommonAbstractTe // Now must check the cache again, to make sure that we didn't miss the key insert while we // were busy setting up the cache listener. // Check asynchronously. - IgniteCache<Integer, String> asyncCache = cache.withAsync(); - asyncCache.get(key); - // Complete the promise if the key was inserted concurrently. - asyncCache.<String>future().listen(new IgniteInClosure<IgniteFuture<String>>() { + cache.getAsync(key).listen(new IgniteInClosure<IgniteFuture<String>>() { @Override public void apply(IgniteFuture<String> f) { String value = f.get(); http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/internal/processors/closure/GridClosureProcessorSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/closure/GridClosureProcessorSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/closure/GridClosureProcessorSelfTest.java index b6542ab..fec0637 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/closure/GridClosureProcessorSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/closure/GridClosureProcessorSelfTest.java @@ -31,11 +31,11 @@ import org.apache.ignite.IgniteException; import org.apache.ignite.IgniteLogger; import org.apache.ignite.cluster.ClusterGroup; import org.apache.ignite.cluster.ClusterNode; -import org.apache.ignite.compute.ComputeTaskFuture; import org.apache.ignite.compute.ComputeTaskTimeoutException; import org.apache.ignite.configuration.IgniteConfiguration; import org.apache.ignite.internal.util.typedef.F; import org.apache.ignite.lang.IgniteCallable; +import org.apache.ignite.lang.IgniteFuture; import org.apache.ignite.lang.IgnitePredicate; import org.apache.ignite.lang.IgniteReducer; import org.apache.ignite.lang.IgniteRunnable; @@ -114,7 +114,7 @@ public class GridClosureProcessorSelfTest extends GridCommonAbstractTest { @LoggerResource private IgniteLogger log; - /** @{inheritDoc} */ + /** {@inheritDoc} */ @Override public void run() { log.info("Runnable job executed on node: " + ignite.cluster().localNode().id()); @@ -198,7 +198,7 @@ public class GridClosureProcessorSelfTest extends GridCommonAbstractTest { * @param p Optional node predicate. * @return Future object. */ - private ComputeTaskFuture<?> runAsync(int idx, IgniteRunnable job, @Nullable IgnitePredicate<ClusterNode> p) { + private IgniteFuture<?> runAsync(int idx, IgniteRunnable job, @Nullable IgnitePredicate<ClusterNode> p) { assert idx >= 0 && idx < NODES_CNT; assert job != null; @@ -206,11 +206,7 @@ public class GridClosureProcessorSelfTest extends GridCommonAbstractTest { IgniteCompute comp = p != null ? compute(grid(idx).cluster().forPredicate(p)) : grid(idx).compute(); - comp = comp.withAsync(); - - comp.run(job); - - return comp.future(); + return comp.runAsync(job); } /** @@ -219,7 +215,7 @@ public class GridClosureProcessorSelfTest extends GridCommonAbstractTest { * @param p Optional node predicate. * @return Future object. */ - private ComputeTaskFuture<?> broadcast(int idx, IgniteRunnable job, @Nullable IgnitePredicate<ClusterNode> p) { + private IgniteFuture<?> broadcast(int idx, IgniteRunnable job, @Nullable IgnitePredicate<ClusterNode> p) { assert idx >= 0 && idx < NODES_CNT; assert job != null; @@ -230,11 +226,7 @@ public class GridClosureProcessorSelfTest extends GridCommonAbstractTest { if (p != null) prj = prj.forPredicate(p); - IgniteCompute comp = compute(prj).withAsync(); - - comp.broadcast(job); - - return comp.future(); + return compute(prj).broadcastAsync(job); } /** @@ -243,7 +235,7 @@ public class GridClosureProcessorSelfTest extends GridCommonAbstractTest { * @param p Optional node predicate. * @return Future object. */ - private ComputeTaskFuture<?> runAsync(int idx, + private IgniteFuture<?> runAsync(int idx, Collection<ClosureTestRunnable> jobs, @Nullable IgnitePredicate<ClusterNode> p) { @@ -254,11 +246,7 @@ public class GridClosureProcessorSelfTest extends GridCommonAbstractTest { IgniteCompute comp = p != null ? compute(grid(idx).cluster().forPredicate(p)) : grid(idx).compute(); - comp = comp.withAsync(); - - comp.run(jobs); - - return comp.future(); + return comp.runAsync(jobs); } /** @@ -267,7 +255,7 @@ public class GridClosureProcessorSelfTest extends GridCommonAbstractTest { * @param p Optional node predicate. * @return Future object. */ - private ComputeTaskFuture<Integer> callAsync(int idx, + private IgniteFuture<Integer> callAsync(int idx, IgniteCallable<Integer> job, @Nullable IgnitePredicate<ClusterNode> p) { assert idx >= 0 && idx < NODES_CNT; @@ -277,11 +265,7 @@ public class GridClosureProcessorSelfTest extends GridCommonAbstractTest { IgniteCompute comp = p != null ? compute(grid(idx).cluster().forPredicate(p)) : grid(idx).compute(); - comp = comp.withAsync(); - - comp.call(job); - - return comp.future(); + return comp.callAsync(job); } /** @@ -290,7 +274,7 @@ public class GridClosureProcessorSelfTest extends GridCommonAbstractTest { * @param p Optional node predicate. * @return Future object. */ - private ComputeTaskFuture<Collection<Integer>> broadcast(int idx, IgniteCallable<Integer> job, + private IgniteFuture<Collection<Integer>> broadcast(int idx, IgniteCallable<Integer> job, @Nullable IgnitePredicate<ClusterNode> p) { assert idx >= 0 && idx < NODES_CNT; assert job != null; @@ -299,11 +283,7 @@ public class GridClosureProcessorSelfTest extends GridCommonAbstractTest { IgniteCompute comp = p != null ? compute(grid(idx).cluster().forPredicate(p)) : grid(idx).compute(); - comp = comp.withAsync(); - - comp.broadcast(job); - - return comp.future(); + return comp.broadcastAsync(job); } /** @@ -312,7 +292,7 @@ public class GridClosureProcessorSelfTest extends GridCommonAbstractTest { * @param p Optional node predicate. * @return Future object. */ - private ComputeTaskFuture<Collection<Integer>> callAsync(int idx, Collection<ClosureTestCallable> jobs, + private IgniteFuture<Collection<Integer>> callAsync(int idx, Collection<ClosureTestCallable> jobs, @Nullable IgnitePredicate<ClusterNode> p) { assert idx >= 0 && idx < NODES_CNT; assert !F.isEmpty(jobs); @@ -321,11 +301,7 @@ public class GridClosureProcessorSelfTest extends GridCommonAbstractTest { IgniteCompute comp = p != null ? compute(grid(idx).cluster().forPredicate(p)) : grid(idx).compute(); - comp = comp.withAsync(); - - comp.call(jobs); - - return comp.future(); + return comp.callAsync(jobs); } /** @@ -346,7 +322,7 @@ public class GridClosureProcessorSelfTest extends GridCommonAbstractTest { public void testRunAsyncSingle() throws Exception { IgniteRunnable job = new ClosureTestRunnable(); - ComputeTaskFuture<?> fut = broadcast(0, job, null); + IgniteFuture<?> fut = broadcast(0, job, null); assert fut.get() == null; @@ -372,7 +348,7 @@ public class GridClosureProcessorSelfTest extends GridCommonAbstractTest { public void testRunAsyncMultiple() throws Exception { Collection<ClosureTestRunnable> jobs = F.asList(new ClosureTestRunnable(), new ClosureTestRunnable()); - ComputeTaskFuture<?> fut = runAsync(0, jobs, null); + IgniteFuture<?> fut = runAsync(0, jobs, null); assert fut.get() == null : "Execution result must be null."; @@ -386,7 +362,7 @@ public class GridClosureProcessorSelfTest extends GridCommonAbstractTest { public void testCallAsyncSingle() throws Exception { IgniteCallable<Integer> job = new ClosureTestCallable(); - ComputeTaskFuture<Collection<Integer>> fut1 = broadcast(0, job, null); + IgniteFuture<Collection<Integer>> fut1 = broadcast(0, job, null); assert fut1.get() != null; @@ -399,7 +375,7 @@ public class GridClosureProcessorSelfTest extends GridCommonAbstractTest { assertEquals(1, execCntr.get()); - ComputeTaskFuture<Integer> fut2 = callAsync(0, job, null); + IgniteFuture<Integer> fut2 = callAsync(0, job, null); assert fut2.get() == 1 : "Execution result must be equal to 1, actual: " + fut2.get(); @@ -412,11 +388,9 @@ public class GridClosureProcessorSelfTest extends GridCommonAbstractTest { * @throws Exception If failed. */ public void testCallAsyncErrorNoFailover() throws Exception { - IgniteCompute comp = compute(grid(0).cluster().forPredicate(F.notEqualTo(grid(0).localNode()))).withAsync(); - - comp.withNoFailover().call(new ClosureTestCallableError()); + IgniteCompute comp = compute(grid(0).cluster().forPredicate(F.notEqualTo(grid(0).localNode()))); - ComputeTaskFuture<Integer> fut = comp.future(); + IgniteFuture<Integer> fut = comp.withNoFailover().callAsync(new ClosureTestCallableError()); try { fut.get(); @@ -472,7 +446,7 @@ public class GridClosureProcessorSelfTest extends GridCommonAbstractTest { public void testCallAsyncMultiple() throws Exception { Collection<ClosureTestCallable> jobs = F.asList(new ClosureTestCallable(), new ClosureTestCallable()); - ComputeTaskFuture<Collection<Integer>> fut = callAsync(0, jobs, null); + IgniteFuture<Collection<Integer>> fut = callAsync(0, jobs, null); Collection<Integer> results = fut.get(); @@ -491,11 +465,7 @@ public class GridClosureProcessorSelfTest extends GridCommonAbstractTest { public void testReduceAsync() throws Exception { Collection<ClosureTestCallable> jobs = F.asList(new ClosureTestCallable(), new ClosureTestCallable()); - IgniteCompute comp = grid(0).compute().withAsync(); - - comp.call(jobs, F.sumIntReducer()); - - ComputeTaskFuture<Integer> fut = comp.future(); + IgniteFuture<Integer> fut = grid(0).compute().callAsync(jobs, F.sumIntReducer()); // Sum of arithmetic progression. int exp = (1 + jobs.size()) * jobs.size() / 2; http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/internal/processors/compute/GridComputeJobExecutionErrorToLogManualTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/compute/GridComputeJobExecutionErrorToLogManualTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/compute/GridComputeJobExecutionErrorToLogManualTest.java index ce89e81..939101f 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/compute/GridComputeJobExecutionErrorToLogManualTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/compute/GridComputeJobExecutionErrorToLogManualTest.java @@ -18,7 +18,6 @@ package org.apache.ignite.internal.processors.compute; import org.apache.ignite.Ignite; -import org.apache.ignite.IgniteCompute; import org.apache.ignite.configuration.IgniteConfiguration; import org.apache.ignite.lang.IgniteFuture; import org.apache.ignite.lang.IgniteInClosure; @@ -67,8 +66,7 @@ public class GridComputeJobExecutionErrorToLogManualTest extends GridCommonAbstr public void testRuntimeException() throws Exception { Ignite ignite = grid(0); - IgniteCompute async = ignite.compute().withAsync(); - async.run(new IgniteRunnable() { + ignite.compute().runAsync(new IgniteRunnable() { @Override public void run() { try { Thread.sleep(500); @@ -77,10 +75,8 @@ public class GridComputeJobExecutionErrorToLogManualTest extends GridCommonAbstr // No-op. } } - }); - - async.future().listen(new IgniteInClosure<IgniteFuture<Object>>() { - @Override public void apply(IgniteFuture<Object> future) { + }).listen(new IgniteInClosure<IgniteFuture<Void>>() { + @Override public void apply(IgniteFuture<Void> future) { throw new RuntimeException(); } });
