You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by vo...@apache.org on 2015/10/27 15:45:40 UTC
[4/4] ignite git commit: IGNITE-1652: .Net async API reworked.
IGNITE-1652: .Net async API reworked.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/cc1aa533
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/cc1aa533
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/cc1aa533
Branch: refs/heads/ignite-1282
Commit: cc1aa5331bbcfe0f5c0b6fe1dc230dc855c9b8f7
Parents: 4097810
Author: Pavel Tupitsyn <pt...@gridgain.com>
Authored: Tue Oct 27 17:46:19 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Tue Oct 27 17:46:19 2015 +0300
----------------------------------------------------------------------
.../Interop/GetAsyncBenchmark.cs | 6 +-
.../Interop/PutAsyncBenchmark.cs | 6 +-
.../Cache/CacheAbstractTest.cs | 187 +++----
.../Cache/CacheTestAsyncWrapper.cs | 294 +++++++----
.../Cache/Query/CacheQueriesTest.cs | 8 -
.../Cache/Store/CacheStoreTest.cs | 17 +-
.../Compute/ComputeApiTest.cs | 11 +-
.../Dataload/DataStreamerTest.cs | 40 +-
.../Apache.Ignite.Core.Tests/EventsTest.cs | 39 +-
.../Apache.Ignite.Core.Tests/ExceptionsTest.cs | 37 +-
.../Apache.Ignite.Core.Tests/FutureTest.cs | 104 +---
.../Apache.Ignite.Core.Tests/MessagingTest.cs | 42 +-
.../Services/ServicesAsyncWrapper.cs | 90 ++--
.../Apache.Ignite.Core.csproj | 11 -
.../dotnet/Apache.Ignite.Core/Cache/ICache.cs | 370 ++++++++++---
.../Common/AsyncSupportedAttribute.cs | 33 --
.../Apache.Ignite.Core/Common/IAsyncSupport.cs | 52 --
.../dotnet/Apache.Ignite.Core/Common/IFuture.cs | 115 ----
.../Compute/ComputeTaskAdapter.cs | 2 +-
.../Apache.Ignite.Core/Compute/ICompute.cs | 210 +++++++-
.../Apache.Ignite.Core/Compute/IComputeTask.cs | 2 +-
.../Datastream/IDataStreamer.cs | 22 +-
.../dotnet/Apache.Ignite.Core/Events/IEvents.cs | 68 ++-
.../Apache.Ignite.Core/Impl/Cache/CacheImpl.cs | 401 ++++++++++----
.../Impl/Cache/CacheProxyImpl.cs | 519 -------------------
.../Impl/Common/AsyncResult.cs | 71 ---
.../Impl/Common/CompletedAsyncResult.cs | 59 ---
.../Apache.Ignite.Core/Impl/Common/Future.cs | 203 +-------
.../Apache.Ignite.Core/Impl/Compute/Compute.cs | 135 ++++-
.../Impl/Compute/ComputeAsync.cs | 264 ----------
.../Impl/Compute/ComputeImpl.cs | 40 +-
.../Impl/Compute/ComputeTaskHolder.cs | 2 +-
.../Impl/Datastream/DataStreamerBatch.cs | 12 +-
.../Impl/Datastream/DataStreamerImpl.cs | 18 +-
.../Apache.Ignite.Core/Impl/Events/Events.cs | 129 +++--
.../Impl/Events/EventsAsync.cs | 159 ------
.../dotnet/Apache.Ignite.Core/Impl/Ignite.cs | 4 +-
.../Apache.Ignite.Core/Impl/IgniteUtils.cs | 9 -
.../Impl/Messaging/Messaging.cs | 97 ++--
.../Impl/Messaging/MessagingAsync.cs | 68 ---
.../Apache.Ignite.Core/Impl/PlatformTarget.cs | 21 +-
.../Impl/Services/Services.cs | 124 +++--
.../Impl/Services/ServicesAsync.cs | 89 ----
.../Impl/Transactions/AsyncTransaction.cs | 78 ---
.../Impl/Transactions/Transaction.cs | 78 ++-
.../Impl/Transactions/TransactionImpl.cs | 47 +-
.../Impl/Transactions/TransactionsImpl.cs | 10 +-
.../Impl/Unmanaged/UnmanagedCallbacks.cs | 4 +-
.../Unmanaged/UnmanagedNonReleaseableTarget.cs | 9 +-
.../Apache.Ignite.Core/Messaging/IMessaging.cs | 28 +-
.../Apache.Ignite.Core/Services/IServices.cs | 98 +++-
.../Transactions/ITransaction.cs | 16 +-
.../Datagrid/CrossPlatformExample.cs | 14 +-
53 files changed, 1905 insertions(+), 2667 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/cc1aa533/modules/platforms/dotnet/Apache.Ignite.Benchmarks/Interop/GetAsyncBenchmark.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Benchmarks/Interop/GetAsyncBenchmark.cs b/modules/platforms/dotnet/Apache.Ignite.Benchmarks/Interop/GetAsyncBenchmark.cs
index d7e0c41..9b99aa1 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Benchmarks/Interop/GetAsyncBenchmark.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Benchmarks/Interop/GetAsyncBenchmark.cs
@@ -41,8 +41,6 @@ namespace Apache.Ignite.Benchmarks.Interop
for (int i = 0; i < Emps.Length; i++)
_cache.Put(i, Emps[i]);
-
- _cache = _cache.WithAsync();
}
/** <inheritDoc /> */
@@ -58,9 +56,7 @@ namespace Apache.Ignite.Benchmarks.Interop
{
int idx = BenchmarkUtils.GetRandomInt(Dataset);
- _cache.Get(idx);
-
- _cache.GetFuture<Employee>().ToTask().Wait();
+ _cache.GetAsync(idx).Wait();
}
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/cc1aa533/modules/platforms/dotnet/Apache.Ignite.Benchmarks/Interop/PutAsyncBenchmark.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Benchmarks/Interop/PutAsyncBenchmark.cs b/modules/platforms/dotnet/Apache.Ignite.Benchmarks/Interop/PutAsyncBenchmark.cs
index 475a0c6..5efe0ca 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Benchmarks/Interop/PutAsyncBenchmark.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Benchmarks/Interop/PutAsyncBenchmark.cs
@@ -36,7 +36,7 @@ namespace Apache.Ignite.Benchmarks.Interop
{
base.OnStarted();
- _cache = Node.GetCache<object, object>(CacheName).WithAsync();
+ _cache = Node.GetCache<object, object>(CacheName);
}
/** <inheritDoc /> */
@@ -52,9 +52,7 @@ namespace Apache.Ignite.Benchmarks.Interop
{
int idx = BenchmarkUtils.GetRandomInt(Dataset);
- _cache.Put(idx, Emps[idx]);
-
- _cache.GetFuture<object>().Get();
+ _cache.PutAsync(idx, Emps[idx]).Wait();
}
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/cc1aa533/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheAbstractTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheAbstractTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheAbstractTest.cs
index 19ea37d..ca85a2a 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheAbstractTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheAbstractTest.cs
@@ -525,7 +525,7 @@ namespace Apache.Ignite.Core.Tests.Cache
[Test]
public void TestGetAsync()
{
- var cache = Cache().WithAsync().WrapAsync();
+ var cache = Cache().WrapAsync();
cache.Put(1, 1);
cache.Put(2, 2);
@@ -534,6 +534,9 @@ namespace Apache.Ignite.Core.Tests.Cache
Assert.AreEqual(2, cache.Get(2));
Assert.IsFalse(cache.ContainsKey(3));
Assert.Throws<KeyNotFoundException>(() => cache.Get(3));
+
+ Assert.AreEqual(1, Cache().TryGetAsync(1).Result.Value);
+ Assert.IsFalse(Cache().TryGetAsync(3).Result.Success);
}
[Test]
@@ -558,7 +561,7 @@ namespace Apache.Ignite.Core.Tests.Cache
[Test]
public void TestGetAllAsync()
{
- var cache = Cache().WithAsync().WrapAsync();
+ var cache = Cache().WrapAsync();
cache.Put(1, 1);
cache.Put(2, 2);
@@ -631,7 +634,7 @@ namespace Apache.Ignite.Core.Tests.Cache
[Test]
public void TestGetAndPutAsync()
{
- var cache = Cache().WithAsync().WrapAsync();
+ var cache = Cache().WrapAsync();
Assert.AreEqual(false, cache.ContainsKey(1));
@@ -661,7 +664,7 @@ namespace Apache.Ignite.Core.Tests.Cache
[Test]
public void TestPutxAsync()
{
- var cache = Cache().WithAsync().WrapAsync();
+ var cache = Cache().WrapAsync();
cache.Put(1, 1);
@@ -703,7 +706,7 @@ namespace Apache.Ignite.Core.Tests.Cache
[Test]
public void TestGetAndPutIfAbsentAsync()
{
- var cache = Cache().WithAsync().WrapAsync();
+ var cache = Cache().WrapAsync();
Assert.IsFalse(cache.ContainsKey(1));
@@ -723,7 +726,7 @@ namespace Apache.Ignite.Core.Tests.Cache
[Test]
public void TestPutIfAbsentAsync()
{
- var cache = Cache().WithAsync().WrapAsync();
+ var cache = Cache().WrapAsync();
Assert.Throws<KeyNotFoundException>(() => cache.Get(1));
Assert.IsFalse(cache.ContainsKey(1));
@@ -772,7 +775,7 @@ namespace Apache.Ignite.Core.Tests.Cache
[Test]
public void TestGetAndReplaceAsync()
{
- var cache = Cache().WithAsync().WrapAsync();
+ var cache = Cache().WrapAsync();
Assert.IsFalse(cache.ContainsKey(1));
@@ -824,7 +827,7 @@ namespace Apache.Ignite.Core.Tests.Cache
[Test]
public void TestReplaceAsync()
{
- var cache = Cache().WithAsync().WrapAsync();
+ var cache = Cache().WrapAsync();
Assert.IsFalse(cache.ContainsKey(1));
@@ -856,7 +859,7 @@ namespace Apache.Ignite.Core.Tests.Cache
[Test]
public void TestPutAllAsync()
{
- var cache = Cache().WithAsync().WrapAsync();
+ var cache = Cache().WrapAsync();
cache.PutAll(new Dictionary<int, int> { { 1, 1 }, { 2, 2 }, { 3, 3 } });
@@ -1207,7 +1210,7 @@ namespace Apache.Ignite.Core.Tests.Cache
[Test]
public void TestGetAndRemoveAsync()
{
- var cache = Cache().WithAsync().WrapAsync();
+ var cache = Cache().WrapAsync();
cache.Put(1, 1);
@@ -1251,7 +1254,7 @@ namespace Apache.Ignite.Core.Tests.Cache
[Test]
public void TestRemoveAsync()
{
- var cache = Cache().WithAsync().WrapAsync();
+ var cache = Cache().WrapAsync();
cache.Put(1, 1);
@@ -1288,7 +1291,7 @@ namespace Apache.Ignite.Core.Tests.Cache
[Test]
public void TestRemoveAllAsync()
{
- var cache = Cache().WithAsync().WrapAsync();
+ var cache = Cache().WrapAsync();
List<int> keys = PrimaryKeysForCache(cache, 2);
@@ -1331,7 +1334,7 @@ namespace Apache.Ignite.Core.Tests.Cache
[Test]
public void TestRemoveAllKeysAsync()
{
- var cache = Cache().WithAsync().WrapAsync();
+ var cache = Cache().WrapAsync();
Assert.AreEqual(0, cache.GetSize());
@@ -1572,7 +1575,7 @@ namespace Apache.Ignite.Core.Tests.Cache
[Test]
public void TestPutGetPortableAsync()
{
- var cache = Cache<int, PortablePerson>().WithAsync().WrapAsync();
+ var cache = Cache<int, PortablePerson>().WrapAsync();
PortablePerson obj1 = new PortablePerson("obj1", 1);
@@ -1601,28 +1604,22 @@ namespace Apache.Ignite.Core.Tests.Cache
[Test]
public void TestGetAsync2()
{
- var cache = Cache().WithAsync();
+ var cache = Cache();
for (int i = 0; i < 100; i++)
- {
cache.Put(i, i);
- cache.GetFuture<object>().Get();
- }
-
- var futs = new List<IFuture<int>>();
+ var futs = new List<Task<int>>();
for (int i = 0; i < 1000; i++)
{
- cache.Get(i % 100);
-
- futs.Add(cache.GetFuture<int>());
+ futs.Add(cache.GetAsync(i % 100));
}
for (int i = 0; i < 1000; i++) {
- Assert.AreEqual(i % 100, futs[i].Get(), "Unexpected result: " + i);
+ Assert.AreEqual(i % 100, futs[i].Result, "Unexpected result: " + i);
- Assert.IsTrue(futs[i].IsDone);
+ Assert.IsTrue(futs[i].IsCompleted);
}
}
@@ -1630,30 +1627,22 @@ namespace Apache.Ignite.Core.Tests.Cache
[Category(TestUtils.CategoryIntensive)]
public void TestGetAsyncMultithreaded()
{
- var cache = Cache().WithAsync();
+ var cache = Cache();
for (int i = 0; i < 100; i++)
- {
cache.Put(i, i);
- cache.GetFuture<object>().Get();
- }
-
TestUtils.RunMultiThreaded(() =>
{
for (int i = 0; i < 100; i++)
{
- var futs = new List<IFuture<int>>();
+ var futs = new List<Task<int>>();
for (int j = 0; j < 100; j++)
- {
- cache.Get(j);
-
- futs.Add(cache.GetFuture<int>());
- }
+ futs.Add(cache.GetAsync(j));
for (int j = 0; j < 100; j++)
- Assert.AreEqual(j, futs[j].Get());
+ Assert.AreEqual(j, futs[j].Result);
}
}, 10);
}
@@ -1662,7 +1651,7 @@ namespace Apache.Ignite.Core.Tests.Cache
[Category(TestUtils.CategoryIntensive)]
public void TestPutxAsyncMultithreaded()
{
- var cache = Cache().WithAsync();
+ var cache = Cache();
TestUtils.RunMultiThreaded(() =>
{
@@ -1670,17 +1659,13 @@ namespace Apache.Ignite.Core.Tests.Cache
for (int i = 0; i < 50; i++)
{
- var futs = new List<IFuture<object>>();
+ var futs = new List<Task>();
for (int j = 0; j < 10; j++)
- {
- cache.Put(rnd.Next(1000), i);
-
- futs.Add(cache.GetFuture<object>());
- }
+ futs.Add(cache.PutAsync(rnd.Next(1000), i));
foreach (var fut in futs)
- fut.Get();
+ fut.Wait();
}
}, 5);
}
@@ -1689,7 +1674,7 @@ namespace Apache.Ignite.Core.Tests.Cache
[Category(TestUtils.CategoryIntensive)]
public void TestPutGetAsyncMultithreaded()
{
- var cache = Cache<CacheTestKey, PortablePerson>().WithAsync();
+ var cache = Cache<CacheTestKey, PortablePerson>();
const int threads = 10;
const int objPerThread = 1000;
@@ -1701,22 +1686,20 @@ namespace Apache.Ignite.Core.Tests.Cache
// ReSharper disable once AccessToModifiedClosure
int threadIdx = Interlocked.Increment(ref cntr);
- var futs = new List<IFuture<object>>();
+ var futs = new List<Task>();
for (int i = 0; i < objPerThread; i++)
{
int key = threadIdx * objPerThread + i;
- cache.Put(new CacheTestKey(key), new PortablePerson("Person-" + key, key));
-
- futs.Add(cache.GetFuture<object>());
+ futs.Add(cache.PutAsync(new CacheTestKey(key), new PortablePerson("Person-" + key, key)));
}
foreach (var fut in futs)
{
- fut.Get();
+ fut.Wait();
- Assert.IsTrue(fut.IsDone);
+ Assert.IsTrue(fut.IsCompleted);
}
}, threads);
@@ -1728,8 +1711,7 @@ namespace Apache.Ignite.Core.Tests.Cache
{
int key = threadIdx * objPerThread + i;
- cache.Get(new CacheTestKey(key));
- var p = cache.GetFuture<PortablePerson>().Get();
+ var p = cache.GetAsync(new CacheTestKey(key)).Result;
Assert.IsNotNull(p);
Assert.AreEqual(key, p.Age);
@@ -1747,9 +1729,7 @@ namespace Apache.Ignite.Core.Tests.Cache
{
int key = threadIdx * objPerThread + i;
- cache.Put(new CacheTestKey(key), new PortablePerson("Person-" + key, key));
-
- cache.GetFuture<object>().Get();
+ cache.PutAsync(new CacheTestKey(key), new PortablePerson("Person-" + key, key)).Wait();
}
}, threads);
@@ -1759,15 +1739,13 @@ namespace Apache.Ignite.Core.Tests.Cache
{
int threadIdx = Interlocked.Increment(ref cntr);
- var futs = new List<IFuture<PortablePerson>>();
+ var futs = new List<Task<PortablePerson>>();
for (int i = 0; i < objPerThread; i++)
{
int key = threadIdx * objPerThread + i;
- cache.Get(new CacheTestKey(key));
-
- futs.Add(cache.GetFuture<PortablePerson>());
+ futs.Add(cache.GetAsync(new CacheTestKey(key)));
}
for (int i = 0; i < objPerThread; i++)
@@ -1776,7 +1754,7 @@ namespace Apache.Ignite.Core.Tests.Cache
int key = threadIdx * objPerThread + i;
- var p = fut.Get();
+ var p = fut.Result;
Assert.IsNotNull(p);
Assert.AreEqual(key, p.Age);
@@ -1789,8 +1767,8 @@ namespace Apache.Ignite.Core.Tests.Cache
//[Category(TestUtils.CATEGORY_INTENSIVE)]
public void TestAsyncMultithreadedKeepPortable()
{
- var cache = Cache().WithAsync().WithKeepPortable<CacheTestKey, PortablePerson>();
- var portCache = Cache().WithAsync().WithKeepPortable<CacheTestKey, IPortableObject>();
+ var cache = Cache().WithKeepPortable<CacheTestKey, PortablePerson>();
+ var portCache = Cache().WithKeepPortable<CacheTestKey, IPortableObject>();
const int threads = 10;
const int objPerThread = 1000;
@@ -1802,19 +1780,19 @@ namespace Apache.Ignite.Core.Tests.Cache
// ReSharper disable once AccessToModifiedClosure
int threadIdx = Interlocked.Increment(ref cntr);
- var futs = new List<IFuture<object>>();
+ var futs = new List<Task>();
for (int i = 0; i < objPerThread; i++)
{
int key = threadIdx * objPerThread + i;
- cache.Put(new CacheTestKey(key), new PortablePerson("Person-" + key, key));
+ var task = cache.PutAsync(new CacheTestKey(key), new PortablePerson("Person-" + key, key));
- futs.Add(cache.GetFuture<object>());
+ futs.Add(task);
}
foreach (var fut in futs)
- Assert.IsNull(fut.Get());
+ fut.Wait();
}, threads);
for (int i = 0; i < threads; i++)
@@ -1839,15 +1817,13 @@ namespace Apache.Ignite.Core.Tests.Cache
{
int threadIdx = Interlocked.Increment(ref cntr);
- var futs = new List<IFuture<IPortableObject>>();
+ var futs = new List<Task<IPortableObject>>();
for (int i = 0; i < objPerThread; i++)
{
int key = threadIdx * objPerThread + i;
- portCache.Get(new CacheTestKey(key));
-
- futs.Add(cache.GetFuture<IPortableObject>());
+ futs.Add(portCache.GetAsync(new CacheTestKey(key)));
}
for (int i = 0; i < objPerThread; i++)
@@ -1856,7 +1832,7 @@ namespace Apache.Ignite.Core.Tests.Cache
int key = threadIdx * objPerThread + i;
- var p = fut.Get();
+ var p = fut.Result;
Assert.IsNotNull(p);
Assert.AreEqual(key, p.GetField<int>("age"));
@@ -1870,22 +1846,20 @@ namespace Apache.Ignite.Core.Tests.Cache
{
int threadIdx = Interlocked.Increment(ref cntr);
- var futs = new List<IFuture<bool>>();
+ var futs = new List<Task<bool>>();
for (int i = 0; i < objPerThread; i++)
{
int key = threadIdx * objPerThread + i;
- cache.Remove(new CacheTestKey(key));
-
- futs.Add(cache.GetFuture<bool>());
+ futs.Add(cache.RemoveAsync(new CacheTestKey(key)));
}
for (int i = 0; i < objPerThread; i++)
{
var fut = futs[i];
- Assert.AreEqual(true, fut.Get());
+ Assert.IsTrue(fut.Result);
}
}, threads);
}
@@ -2050,16 +2024,11 @@ namespace Apache.Ignite.Core.Tests.Cache
if (async)
{
- var asyncTx = tx.WithAsync();
-
- asyncTx.Commit();
-
- var fut = asyncTx.GetFuture();
+ var task = tx.CommitAsync();
- fut.Get();
+ task.Wait();
- Assert.IsTrue(fut.IsDone);
- Assert.AreEqual(fut.Get(), null);
+ Assert.IsTrue(task.IsCompleted);
}
else
tx.Commit();
@@ -2398,24 +2367,22 @@ namespace Apache.Ignite.Core.Tests.Cache
// Expected
}
- tx = Transactions.TxStart().WithAsync();
+ tx = Transactions.TxStart();
Assert.AreEqual(TransactionState.Active, tx.State);
- tx.Commit();
-
- tx.GetFuture().Get();
+ tx.CommitAsync().Wait();
Assert.AreEqual(TransactionState.Committed, tx.State);
- tx.Rollback(); // Illegal, but should not fail here; will fail in future
+ var task = tx.RollbackAsync(); // Illegal, but should not fail here; will fail in task
try
{
- tx.GetFuture<object>().Get();
+ task.Wait();
Assert.Fail();
}
- catch (InvalidOperationException)
+ catch (AggregateException)
{
// Expected
}
@@ -2492,22 +2459,21 @@ namespace Apache.Ignite.Core.Tests.Cache
[Category(TestUtils.CategoryIntensive)]
public void TestFuturesGc()
{
- var cache = Cache().WithAsync();
+ var cache = Cache();
- cache.Put(1, 1);
+ cache.PutAsync(1, 1);
for (int i = 0; i < 10; i++)
{
TestUtils.RunMultiThreaded(() =>
{
for (int j = 0; j < 1000; j++)
- cache.Get(1);
+ cache.GetAsync(1);
}, 5);
GC.Collect();
- cache.Get(1);
- Assert.AreEqual(1, cache.GetFuture<int>().Get());
+ Assert.AreEqual(1, cache.GetAsync(1).Result);
}
Thread.Sleep(2000);
@@ -2872,7 +2838,7 @@ namespace Apache.Ignite.Core.Tests.Cache
private void TestInvoke<T>(bool async) where T: AddArgCacheEntryProcessor, new()
{
- var cache = async ? Cache().WithAsync().WrapAsync() : Cache();
+ var cache = async ? Cache().WrapAsync() : Cache();
cache.Clear();
@@ -2954,7 +2920,7 @@ namespace Apache.Ignite.Core.Tests.Cache
public void TestInvokeAll<T>(bool async, int entryCount) where T : AddArgCacheEntryProcessor, new()
{
- var cache = async ? Cache().WithAsync().WrapAsync() : Cache();
+ var cache = async ? Cache().WrapAsync() : Cache();
var entries = Enumerable.Range(1, entryCount).ToDictionary(x => x, x => x + 1);
@@ -3018,26 +2984,25 @@ namespace Apache.Ignite.Core.Tests.Cache
[Test]
public void TestSkipStore()
{
- CacheProxyImpl<int, int> cache = (CacheProxyImpl<int, int>)Cache();
+ var cache = (CacheImpl<int, int>) Cache();
- Assert.IsFalse(cache.SkipStore);
+ Assert.IsFalse(cache.IsSkipStore);
// Ensure correct flag set.
- CacheProxyImpl<int, int> cacheSkipStore1 = (CacheProxyImpl<int, int>)cache.WithSkipStore();
+ var cacheSkipStore1 = (CacheImpl<int, int>) cache.WithSkipStore();
Assert.AreNotSame(cache, cacheSkipStore1);
- Assert.IsFalse(cache.SkipStore);
- Assert.IsTrue(cacheSkipStore1.SkipStore);
+ Assert.IsFalse(cache.IsSkipStore);
+ Assert.IsTrue(cacheSkipStore1.IsSkipStore);
// Ensure that the same instance is returned if flag is already set.
- CacheProxyImpl<int, int> cacheSkipStore2 = (CacheProxyImpl<int, int>)cacheSkipStore1.WithSkipStore();
+ var cacheSkipStore2 = (CacheImpl<int, int>) cacheSkipStore1.WithSkipStore();
- Assert.IsTrue(cacheSkipStore2.SkipStore);
+ Assert.IsTrue(cacheSkipStore2.IsSkipStore);
Assert.AreSame(cacheSkipStore1, cacheSkipStore2);
// Ensure other flags are preserved.
- Assert.IsTrue(((CacheProxyImpl<int, int>)cache.WithKeepPortable<int, int>().WithSkipStore()).IsKeepPortable);
- Assert.IsTrue(cache.WithAsync().WithSkipStore().IsAsync);
+ Assert.IsTrue(((CacheImpl<int, int>) cache.WithKeepPortable<int, int>().WithSkipStore()).IsKeepPortable);
}
[Test]
@@ -3061,7 +3026,7 @@ namespace Apache.Ignite.Core.Tests.Cache
var fut = cache.Rebalance();
- Assert.IsNull(fut.Get());
+
}
[Test]
@@ -3125,7 +3090,7 @@ namespace Apache.Ignite.Core.Tests.Cache
private void TestKeepPortableFlag(bool async)
{
- var cache0 = async ? Cache().WithAsync().WrapAsync() : Cache();
+ var cache0 = async ? Cache().WrapAsync() : Cache();
var cache = cache0.WithKeepPortable<int, PortablePerson>();
http://git-wip-us.apache.org/repos/asf/ignite/blob/cc1aa533/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheTestAsyncWrapper.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheTestAsyncWrapper.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheTestAsyncWrapper.cs
index 1b5321c..f6deb42 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheTestAsyncWrapper.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheTestAsyncWrapper.cs
@@ -17,9 +17,11 @@
namespace Apache.Ignite.Core.Tests.Cache
{
+ using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
+ using System.Threading.Tasks;
using Apache.Ignite.Core.Cache;
using Apache.Ignite.Core.Cache.Expiry;
using Apache.Ignite.Core.Cache.Query;
@@ -39,38 +41,12 @@ namespace Apache.Ignite.Core.Tests.Cache
/// <param name="cache">The cache to be wrapped.</param>
public CacheTestAsyncWrapper(ICache<TK, TV> cache)
{
- Debug.Assert(cache.IsAsync, "GridCacheTestAsyncWrapper only works with async caches.");
+ Debug.Assert(cache != null);
_cache = cache;
}
/** <inheritDoc /> */
- public ICache<TK, TV> WithAsync()
- {
- return this;
- }
-
- /** <inheritDoc /> */
- public bool IsAsync
- {
- get { return true; }
- }
-
- /** <inheritDoc /> */
- public IFuture GetFuture()
- {
- Debug.Fail("GridCacheTestAsyncWrapper.Future() should not be called. It always returns null.");
- return null;
- }
-
- /** <inheritDoc /> */
- public IFuture<TResult> GetFuture<TResult>()
- {
- Debug.Fail("GridCacheTestAsyncWrapper.Future() should not be called. It always returns null.");
- return null;
- }
-
- /** <inheritDoc /> */
public string Name
{
get { return _cache.Name; }
@@ -83,7 +59,6 @@ namespace Apache.Ignite.Core.Tests.Cache
}
/** <inheritDoc /> */
-
public bool IsEmpty()
{
return _cache.IsEmpty();
@@ -116,36 +91,55 @@ namespace Apache.Ignite.Core.Tests.Cache
/** <inheritDoc /> */
public void LoadCache(ICacheEntryFilter<TK, TV> p, params object[] args)
{
- _cache.LoadCache(p, args);
- WaitResult();
+ WaitResult(_cache.LoadCacheAsync(p, args));
+ }
+
+ /** <inheritDoc /> */
+ public Task LoadCacheAsync(ICacheEntryFilter<TK, TV> p, params object[] args)
+ {
+ return _cache.LoadCacheAsync(p, args);
}
/** <inheritDoc /> */
public void LocalLoadCache(ICacheEntryFilter<TK, TV> p, params object[] args)
{
- _cache.LocalLoadCache(p, args);
- WaitResult();
+ WaitResult(_cache.LocalLoadCacheAsync(p, args));
+ }
+
+ /** <inheritDoc /> */
+ public Task LocalLoadCacheAsync(ICacheEntryFilter<TK, TV> p, params object[] args)
+ {
+ return _cache.LocalLoadCacheAsync(p, args);
}
/** <inheritDoc /> */
public bool ContainsKey(TK key)
{
- _cache.ContainsKey(key);
- return GetResult<bool>();
+ return GetResult(_cache.ContainsKeyAsync(key));
+ }
+
+ /** <inheritDoc /> */
+ public Task<bool> ContainsKeyAsync(TK key)
+ {
+ return _cache.ContainsKeyAsync(key);
}
/** <inheritDoc /> */
public bool ContainsKeys(IEnumerable<TK> keys)
{
- _cache.ContainsKeys(keys);
- return GetResult<bool>();
+ return GetResult(_cache.ContainsKeysAsync(keys));
+ }
+
+ /** <inheritDoc /> */
+ public Task<bool> ContainsKeysAsync(IEnumerable<TK> keys)
+ {
+ return _cache.ContainsKeysAsync(keys);
}
/** <inheritDoc /> */
public TV LocalPeek(TK key, params CachePeekMode[] modes)
{
- _cache.LocalPeek(key, modes);
- return GetResult<TV>();
+ return _cache.LocalPeek(key, modes);
}
/** <inheritDoc /> */
@@ -164,8 +158,13 @@ namespace Apache.Ignite.Core.Tests.Cache
/** <inheritDoc /> */
public TV Get(TK key)
{
- _cache.Get(key);
- return GetResult<TV>();
+ return GetResult(_cache.GetAsync(key));
+ }
+
+ /** <inheritDoc /> */
+ public Task<TV> GetAsync(TK key)
+ {
+ return _cache.GetAsync(key);
}
/** <inheritDoc /> */
@@ -175,73 +174,129 @@ namespace Apache.Ignite.Core.Tests.Cache
}
/** <inheritDoc /> */
+ public Task<CacheResult<TV>> TryGetAsync(TK key)
+ {
+ return _cache.TryGetAsync(key);
+ }
+
+ /** <inheritDoc /> */
public IDictionary<TK, TV> GetAll(IEnumerable<TK> keys)
{
- _cache.GetAll(keys);
- return GetResult<IDictionary<TK, TV>>();
+ return GetResult(_cache.GetAllAsync(keys));
+ }
+
+ /** <inheritDoc /> */
+ public Task<IDictionary<TK, TV>> GetAllAsync(IEnumerable<TK> keys)
+ {
+ return _cache.GetAllAsync(keys);
}
/** <inheritDoc /> */
public void Put(TK key, TV val)
{
- _cache.Put(key, val);
- WaitResult();
+ WaitResult(_cache.PutAsync(key, val));
+ }
+
+ /** <inheritDoc /> */
+ public Task PutAsync(TK key, TV val)
+ {
+ return _cache.PutAsync(key, val);
}
/** <inheritDoc /> */
public CacheResult<TV> GetAndPut(TK key, TV val)
{
- _cache.GetAndPut(key, val);
- return GetResult<CacheResult<TV>>();
+ return GetResult(_cache.GetAndPutAsync(key, val));
+ }
+
+ /** <inheritDoc /> */
+ public Task<CacheResult<TV>> GetAndPutAsync(TK key, TV val)
+ {
+ return _cache.GetAndPutAsync(key, val);
}
/** <inheritDoc /> */
public CacheResult<TV> GetAndReplace(TK key, TV val)
{
- _cache.GetAndReplace(key, val);
- return GetResult<CacheResult<TV>>();
+ return GetResult(_cache.GetAndReplaceAsync(key, val));
+ }
+
+ /** <inheritDoc /> */
+ public Task<CacheResult<TV>> GetAndReplaceAsync(TK key, TV val)
+ {
+ return _cache.GetAndReplaceAsync(key, val);
}
/** <inheritDoc /> */
public CacheResult<TV> GetAndRemove(TK key)
{
- _cache.GetAndRemove(key);
- return GetResult<CacheResult<TV>>();
+ return GetResult(_cache.GetAndRemoveAsync(key));
+ }
+
+ /** <inheritDoc /> */
+ public Task<CacheResult<TV>> GetAndRemoveAsync(TK key)
+ {
+ return _cache.GetAndRemoveAsync(key);
}
/** <inheritDoc /> */
public bool PutIfAbsent(TK key, TV val)
{
- _cache.PutIfAbsent(key, val);
- return GetResult<bool>();
+ return GetResult(_cache.PutIfAbsentAsync(key, val));
+ }
+
+ /** <inheritDoc /> */
+ public Task<bool> PutIfAbsentAsync(TK key, TV val)
+ {
+ return _cache.PutIfAbsentAsync(key, val);
}
/** <inheritDoc /> */
public CacheResult<TV> GetAndPutIfAbsent(TK key, TV val)
{
- _cache.GetAndPutIfAbsent(key, val);
- return GetResult<CacheResult<TV>>();
+ return GetResult(_cache.GetAndPutIfAbsentAsync(key, val));
+ }
+
+ /** <inheritDoc /> */
+ public Task<CacheResult<TV>> GetAndPutIfAbsentAsync(TK key, TV val)
+ {
+ return _cache.GetAndPutIfAbsentAsync(key, val);
}
/** <inheritDoc /> */
public bool Replace(TK key, TV val)
{
- _cache.Replace(key, val);
- return GetResult<bool>();
+ return GetResult(_cache.ReplaceAsync(key, val));
+ }
+
+ /** <inheritDoc /> */
+ public Task<bool> ReplaceAsync(TK key, TV val)
+ {
+ return _cache.ReplaceAsync(key, val);
}
/** <inheritDoc /> */
public bool Replace(TK key, TV oldVal, TV newVal)
{
- _cache.Replace(key, oldVal, newVal);
- return GetResult<bool>();
+ return GetResult(_cache.ReplaceAsync(key, oldVal, newVal));
+ }
+
+ /** <inheritDoc /> */
+ public Task<bool> ReplaceAsync(TK key, TV oldVal, TV newVal)
+ {
+ return _cache.ReplaceAsync(key, oldVal, newVal);
}
/** <inheritDoc /> */
public void PutAll(IDictionary<TK, TV> vals)
{
- _cache.PutAll(vals);
- WaitResult();
+ WaitResult(_cache.PutAllAsync(vals));
+ }
+
+ /** <inheritDoc /> */
+ public Task PutAllAsync(IDictionary<TK, TV> vals)
+ {
+ return _cache.PutAllAsync(vals);
}
/** <inheritDoc /> */
@@ -253,20 +308,37 @@ namespace Apache.Ignite.Core.Tests.Cache
/** <inheritDoc /> */
public void Clear()
{
- _cache.Clear();
- WaitResult();
+ WaitResult(_cache.ClearAsync());
+ }
+
+ /** <inheritDoc /> */
+ public Task ClearAsync()
+ {
+ return _cache.ClearAsync();
}
/** <inheritDoc /> */
public void Clear(TK key)
{
- _cache.Clear(key);
+ WaitResult(_cache.ClearAsync(key));
+ }
+
+ /** <inheritDoc /> */
+ public Task ClearAsync(TK key)
+ {
+ return _cache.ClearAsync(key);
}
/** <inheritDoc /> */
public void ClearAll(IEnumerable<TK> keys)
{
- _cache.ClearAll(keys);
+ WaitResult(_cache.ClearAllAsync(keys));
+ }
+
+ /** <inheritDoc /> */
+ public Task ClearAllAsync(IEnumerable<TK> keys)
+ {
+ return _cache.ClearAllAsync(keys);
}
/** <inheritDoc /> */
@@ -284,29 +356,49 @@ namespace Apache.Ignite.Core.Tests.Cache
/** <inheritDoc /> */
public bool Remove(TK key)
{
- _cache.Remove(key);
- return GetResult<bool>();
+ return GetResult(_cache.RemoveAsync(key));
+ }
+
+ /** <inheritDoc /> */
+ public Task<bool> RemoveAsync(TK key)
+ {
+ return _cache.RemoveAsync(key);
}
/** <inheritDoc /> */
public bool Remove(TK key, TV val)
{
- _cache.Remove(key, val);
- return GetResult<bool>();
+ return GetResult(_cache.RemoveAsync(key, val));
+ }
+
+ /** <inheritDoc /> */
+ public Task<bool> RemoveAsync(TK key, TV val)
+ {
+ return _cache.RemoveAsync(key, val);
}
/** <inheritDoc /> */
public void RemoveAll(IEnumerable<TK> keys)
{
- _cache.RemoveAll(keys);
- WaitResult();
+ WaitResult(_cache.RemoveAllAsync(keys));
+ }
+
+ /** <inheritDoc /> */
+ public Task RemoveAllAsync(IEnumerable<TK> keys)
+ {
+ return _cache.RemoveAllAsync(keys);
}
/** <inheritDoc /> */
public void RemoveAll()
{
- _cache.RemoveAll();
- WaitResult();
+ WaitResult(_cache.RemoveAllAsync());
+ }
+
+ /** <inheritDoc /> */
+ public Task RemoveAllAsync()
+ {
+ return _cache.RemoveAllAsync();
}
/** <inheritDoc /> */
@@ -318,8 +410,13 @@ namespace Apache.Ignite.Core.Tests.Cache
/** <inheritDoc /> */
public int GetSize(params CachePeekMode[] modes)
{
- _cache.GetSize(modes);
- return GetResult<int>();
+ return GetResult(_cache.GetSizeAsync(modes));
+ }
+
+ /** <inheritDoc /> */
+ public Task<int> GetSizeAsync(params CachePeekMode[] modes)
+ {
+ return _cache.GetSizeAsync(modes);
}
/** <inheritDoc /> */
@@ -361,18 +458,26 @@ namespace Apache.Ignite.Core.Tests.Cache
/** <inheritDoc /> */
public TRes Invoke<TArg, TRes>(TK key, ICacheEntryProcessor<TK, TV, TArg, TRes> processor, TArg arg)
{
- _cache.Invoke(key, processor, arg);
-
- return GetResult<TRes>();
+ return GetResult(_cache.InvokeAsync(key, processor, arg));
+ }
+
+ /** <inheritDoc /> */
+ public Task<TRes> InvokeAsync<TArg, TRes>(TK key, ICacheEntryProcessor<TK, TV, TArg, TRes> processor, TArg arg)
+ {
+ return _cache.InvokeAsync(key, processor, arg);
}
/** <inheritDoc /> */
public IDictionary<TK, ICacheEntryProcessorResult<TRes>> InvokeAll<TArg, TRes>(IEnumerable<TK> keys,
ICacheEntryProcessor<TK, TV, TArg, TRes> processor, TArg arg)
{
- _cache.InvokeAll(keys, processor, arg);
+ return GetResult(_cache.InvokeAllAsync(keys, processor, arg));
+ }
- return GetResult<IDictionary<TK, ICacheEntryProcessorResult<TRes>>>();
+ /** <inheritDoc /> */
+ public Task<IDictionary<TK, ICacheEntryProcessorResult<TRes>>> InvokeAllAsync<TArg, TRes>(IEnumerable<TK> keys, ICacheEntryProcessor<TK, TV, TArg, TRes> processor, TArg arg)
+ {
+ return _cache.InvokeAllAsync(keys, processor, arg);
}
/** <inheritDoc /> */
@@ -400,7 +505,7 @@ namespace Apache.Ignite.Core.Tests.Cache
}
/** <inheritDoc /> */
- public IFuture Rebalance()
+ public Task Rebalance()
{
return _cache.Rebalance();
}
@@ -424,19 +529,34 @@ namespace Apache.Ignite.Core.Tests.Cache
}
/// <summary>
- /// Waits for the async result.
+ /// Waits the result of a task, unwraps exceptions.
/// </summary>
- private void WaitResult()
+ /// <param name="task">The task.</param>
+ private static void WaitResult(Task task)
{
- GetResult<object>();
+ try
+ {
+ task.Wait();
+ }
+ catch (AggregateException ex)
+ {
+ throw ex.InnerException;
+ }
}
/// <summary>
- /// Gets the async result.
+ /// Gets the result of a task, unwraps exceptions.
/// </summary>
- private T GetResult<T>()
- {
- return _cache.GetFuture<T>().Get();
+ private static T GetResult<T>(Task<T> task)
+ {
+ try
+ {
+ return task.Result;
+ }
+ catch (Exception ex)
+ {
+ throw ex.InnerException;
+ }
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/cc1aa533/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheQueriesTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheQueriesTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheQueriesTest.cs
index ba104c0..78173e0 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheQueriesTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheQueriesTest.cs
@@ -194,14 +194,6 @@ namespace Apache.Ignite.Core.Tests.Cache.Query
[SuppressMessage("ReSharper", "ReturnValueOfPureMethodIsNotUsed")]
public void TestCursor()
{
- var cache0 = Cache().WithAsync();
-
- cache0.WithAsync().Put(1, new QueryPerson("Ivanov", 30));
-
- IFuture<object> res = cache0.GetFuture<object>();
-
- res.Get();
-
Cache().Put(1, new QueryPerson("Ivanov", 30));
Cache().Put(1, new QueryPerson("Petrov", 40));
Cache().Put(1, new QueryPerson("Sidorov", 50));
http://git-wip-us.apache.org/repos/asf/ignite/blob/cc1aa533/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheStoreTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheStoreTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheStoreTest.cs
index bfafcf4..bd0f3a7 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheStoreTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheStoreTest.cs
@@ -222,26 +222,17 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
[Test]
public void TestLoadCacheAsync()
{
- var cache = Cache().WithAsync();
+ var cache = Cache();
Assert.AreEqual(0, cache.GetSize());
- cache.LocalLoadCache(new CacheEntryFilter(), 100, 10);
-
- var fut = cache.GetFuture<object>();
+ cache.LocalLoadCacheAsync(new CacheEntryFilter(), 100, 10).Wait();
- fut.Get();
-
- Assert.IsTrue(fut.IsDone);
-
- cache.GetSize();
- Assert.AreEqual(5, cache.GetFuture<int>().ToTask().Result);
+ Assert.AreEqual(5, cache.GetSizeAsync().Result);
for (int i = 105; i < 110; i++)
{
- cache.Get(i);
-
- Assert.AreEqual("val_" + i, cache.GetFuture<string>().ToTask().Result);
+ Assert.AreEqual("val_" + i, cache.GetAsync(i).Result);
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/cc1aa533/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/ComputeApiTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/ComputeApiTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/ComputeApiTest.cs
index b0388cd..cb2c8b4 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/ComputeApiTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/ComputeApiTest.cs
@@ -931,9 +931,9 @@ namespace Apache.Ignite.Core.Tests.Compute
[Test]
public void TestBroadcastTaskAsync()
{
- var gridCompute = _grid1.GetCompute().WithAsync();
- Assert.IsNull(gridCompute.ExecuteJavaTask<ICollection>(BroadcastTask, null));
- var res = gridCompute.GetFuture<ICollection>().Get().OfType<Guid>().ToList();
+ var gridCompute = _grid1.GetCompute();
+
+ var res = gridCompute.ExecuteJavaTaskAsync<ICollection>(BroadcastTask, null).Result.OfType<Guid>().ToList();
Assert.AreEqual(3, res.Count);
Assert.AreEqual(1, _grid1.GetCluster().ForNodeIds(res.ElementAt(0)).GetNodes().Count);
@@ -944,9 +944,8 @@ namespace Apache.Ignite.Core.Tests.Compute
Assert.AreEqual(2, prj.GetNodes().Count);
- var compute = prj.GetCompute().WithAsync();
- Assert.IsNull(compute.ExecuteJavaTask<IList>(BroadcastTask, null));
- var filteredRes = compute.GetFuture<IList>().Get();
+ var compute = prj.GetCompute();
+ var filteredRes = compute.ExecuteJavaTaskAsync<IList>(BroadcastTask, null).Result;
Assert.AreEqual(2, filteredRes.Count);
Assert.IsTrue(filteredRes.Contains(res.ElementAt(0)));
http://git-wip-us.apache.org/repos/asf/ignite/blob/cc1aa533/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Dataload/DataStreamerTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Dataload/DataStreamerTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Dataload/DataStreamerTest.cs
index bad2cf7..c9dea5c 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Dataload/DataStreamerTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Dataload/DataStreamerTest.cs
@@ -32,13 +32,13 @@ namespace Apache.Ignite.Core.Tests.Dataload
/// <summary>
/// Data streamer tests.
/// </summary>
- public class DataStreamerTest
+ public sealed class DataStreamerTest
{
/** Node name. */
- protected const string GridName = "grid";
+ private const string GridName = "grid";
/** Cache name. */
- protected const string CacheName = "partitioned";
+ private const string CacheName = "partitioned";
/** Node. */
private IIgnite _grid;
@@ -50,7 +50,7 @@ namespace Apache.Ignite.Core.Tests.Dataload
/// Initialization routine.
/// </summary>
[TestFixtureSetUp]
- public virtual void InitClient()
+ public void InitClient()
{
_grid = Ignition.Start(GetIgniteConfiguration(GridName));
@@ -63,7 +63,7 @@ namespace Apache.Ignite.Core.Tests.Dataload
///
/// </summary>
[TestFixtureTearDown]
- public virtual void StopGrids()
+ public void StopGrids()
{
Ignition.StopAll(true);
}
@@ -72,7 +72,7 @@ namespace Apache.Ignite.Core.Tests.Dataload
///
/// </summary>
[SetUp]
- public virtual void BeforeTest()
+ public void BeforeTest()
{
Console.WriteLine("Test started: " + TestContext.CurrentContext.Test.Name);
@@ -178,7 +178,7 @@ namespace Apache.Ignite.Core.Tests.Dataload
ldr.TryFlush();
- fut.Get();
+ fut.Wait();
Assert.AreEqual(1, _cache.Get(1));
}
@@ -196,14 +196,14 @@ namespace Apache.Ignite.Core.Tests.Dataload
Thread.Sleep(100);
- Assert.IsFalse(fut.IsDone);
+ Assert.IsFalse(fut.IsCompleted);
ldr.PerNodeBufferSize = 2;
ldr.AddData(2, 2);
ldr.AddData(3, 3);
- ldr.AddData(4, 4).Get();
- fut.Get();
+ ldr.AddData(4, 4).Wait();
+ fut.Wait();
Assert.AreEqual(1, _cache.Get(1));
Assert.AreEqual(2, _cache.Get(2));
@@ -216,7 +216,7 @@ namespace Apache.Ignite.Core.Tests.Dataload
new KeyValuePair<int, int>(6, 6),
new KeyValuePair<int, int>(7, 7),
new KeyValuePair<int, int>(8, 8)
- }).Get();
+ }).Wait();
Assert.AreEqual(5, _cache.Get(5));
Assert.AreEqual(6, _cache.Get(6));
@@ -237,7 +237,7 @@ namespace Apache.Ignite.Core.Tests.Dataload
ldr.Close(false);
- fut.Get();
+ fut.Wait();
Assert.AreEqual(1, _cache.Get(1));
}
@@ -255,7 +255,7 @@ namespace Apache.Ignite.Core.Tests.Dataload
ldr.Close(true);
- fut.Get();
+ fut.Wait();
Assert.IsFalse(_cache.ContainsKey(1));
}
@@ -292,29 +292,29 @@ namespace Apache.Ignite.Core.Tests.Dataload
// Test auto flush turning on.
var fut = ldr.AddData(1, 1);
Thread.Sleep(100);
- Assert.IsFalse(fut.IsDone);
+ Assert.IsFalse(fut.IsCompleted);
ldr.AutoFlushFrequency = 1000;
- fut.Get();
+ fut.Wait();
// Test forced flush after frequency change.
fut = ldr.AddData(2, 2);
- ldr.AutoFlushFrequency = long.MaxValue;
- fut.Get();
+ ldr.AutoFlushFrequency = long.MaxValue;
+ fut.Wait();
// Test another forced flush after frequency change.
fut = ldr.AddData(3, 3);
ldr.AutoFlushFrequency = 1000;
- fut.Get();
+ fut.Wait();
// Test flush before stop.
fut = ldr.AddData(4, 4);
ldr.AutoFlushFrequency = 0;
- fut.Get();
+ fut.Wait();
// Test flush after second turn on.
fut = ldr.AddData(5, 5);
ldr.AutoFlushFrequency = 1000;
- fut.Get();
+ fut.Wait();
Assert.AreEqual(1, _cache.Get(1));
Assert.AreEqual(2, _cache.Get(2));
http://git-wip-us.apache.org/repos/asf/ignite/blob/cc1aa533/modules/platforms/dotnet/Apache.Ignite.Core.Tests/EventsTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/EventsTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/EventsTest.cs
index 33841ad..2dd03da 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/EventsTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/EventsTest.cs
@@ -308,55 +308,50 @@ namespace Apache.Ignite.Core.Tests
var timeout = TimeSpan.FromSeconds(3);
- if (async)
- events = events.WithAsync();
-
var eventType = EventType.TaskExecutionAll;
events.EnableLocal(eventType);
- Func<Func<IEvent>, Task<IEvent>> getWaitTask;
+ Func<IEventFilter<IEvent>, int[], Task<IEvent>> getWaitTask;
if (async)
- getWaitTask = func =>
+ getWaitTask = (filter, types) =>
{
- Assert.IsNull(func());
- var task = events.GetFuture<IEvent>().ToTask();
+ var task = events.WaitForLocalAsync(filter, types);
GenerateTaskEvent();
return task;
};
else
- getWaitTask = func =>
+ getWaitTask = (filter, types) =>
{
- var task = Task.Factory.StartNew(func);
+ var task = Task.Factory.StartNew(() => events.WaitForLocal(filter, types));
Thread.Sleep(500); // allow task to start and begin waiting for events
GenerateTaskEvent();
return task;
};
// No params
- var waitTask = getWaitTask(() => events.WaitForLocal());
+ var waitTask = getWaitTask(null, new int[0]);
waitTask.Wait(timeout);
// Event types
- waitTask = getWaitTask(() => events.WaitForLocal(EventType.TaskReduced));
+ waitTask = getWaitTask(null, new[] {EventType.TaskReduced});
Assert.IsTrue(waitTask.Wait(timeout));
Assert.IsInstanceOf(typeof(TaskEvent), waitTask.Result);
Assert.AreEqual(EventType.TaskReduced, waitTask.Result.Type);
// Filter
- waitTask = getWaitTask(() => events.WaitForLocal(
- new EventFilter<IEvent>(e => e.Type == EventType.TaskReduced)));
+ waitTask = getWaitTask(new EventFilter<IEvent>(e => e.Type == EventType.TaskReduced), new int[0]);
Assert.IsTrue(waitTask.Wait(timeout));
Assert.IsInstanceOf(typeof(TaskEvent), waitTask.Result);
Assert.AreEqual(EventType.TaskReduced, waitTask.Result.Type);
// Filter & types
- waitTask = getWaitTask(() => events.WaitForLocal(
- new EventFilter<IEvent>(e => e.Type == EventType.TaskReduced), EventType.TaskReduced));
+ waitTask = getWaitTask(new EventFilter<IEvent>(e => e.Type == EventType.TaskReduced),
+ new[] {EventType.TaskReduced});
Assert.IsTrue(waitTask.Wait(timeout));
Assert.IsInstanceOf(typeof(TaskEvent), waitTask.Result);
@@ -444,19 +439,11 @@ namespace Apache.Ignite.Core.Tests
var oldEvents = events.RemoteQuery(eventFilter);
- if (async)
- events = events.WithAsync();
-
GenerateTaskEvent();
- var remoteQuery = events.RemoteQuery(eventFilter, EventsTestHelper.Timeout, EventType.JobExecutionAll);
-
- if (async)
- {
- Assert.IsNull(remoteQuery);
-
- remoteQuery = events.GetFuture<List<IEvent>>().Get().ToList();
- }
+ var remoteQuery = !async
+ ? events.RemoteQuery(eventFilter, EventsTestHelper.Timeout, EventType.JobExecutionAll)
+ : events.RemoteQueryAsync(eventFilter, EventsTestHelper.Timeout, EventType.JobExecutionAll).Result;
var qryResult = remoteQuery.Except(oldEvents).Cast<JobEvent>().ToList();
http://git-wip-us.apache.org/repos/asf/ignite/blob/cc1aa533/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ExceptionsTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ExceptionsTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ExceptionsTest.cs
index 7a5a725..b971876 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ExceptionsTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ExceptionsTest.cs
@@ -217,9 +217,6 @@ namespace Apache.Ignite.Core.Tests
{
var cache = grid.GetCache<TK, int>("partitioned_atomic").WithNoRetries();
- if (async)
- cache = cache.WithAsync();
-
if (typeof (TK) == typeof (IPortableObject))
cache = cache.WithKeepPortable<TK, int>();
@@ -231,21 +228,23 @@ namespace Apache.Ignite.Core.Tests
// Do a lot of puts so that one fails during Ignite stop
for (var i = 0; i < 1000000; i++)
{
- cache.PutAll(Enumerable.Range(1, 100).ToDictionary(k => keyFunc(k, grid), k => i));
+ var dict = Enumerable.Range(1, 100).ToDictionary(k => keyFunc(k, grid), k => i);
if (async)
- cache.GetFuture().Get();
+ cache.PutAllAsync(dict).Wait();
+ else
+ cache.PutAll(dict);
}
}
- catch (CachePartialUpdateException ex)
+ catch (AggregateException ex)
{
- var failedKeys = ex.GetFailedKeys<TK>();
-
- Assert.IsTrue(failedKeys.Any());
-
- var failedKeysObj = ex.GetFailedKeys<object>();
+ CheckPartialUpdateException<TK>((CachePartialUpdateException) ex.InnerException);
- Assert.IsTrue(failedKeysObj.Any());
+ return;
+ }
+ catch (CachePartialUpdateException ex)
+ {
+ CheckPartialUpdateException<TK>(ex);
return;
}
@@ -268,6 +267,20 @@ namespace Apache.Ignite.Core.Tests
}
/// <summary>
+ /// Checks the partial update exception.
+ /// </summary>
+ private static void CheckPartialUpdateException<TK>(CachePartialUpdateException ex)
+ {
+ var failedKeys = ex.GetFailedKeys<TK>();
+
+ Assert.IsTrue(failedKeys.Any());
+
+ var failedKeysObj = ex.GetFailedKeys<object>();
+
+ Assert.IsTrue(failedKeysObj.Any());
+ }
+
+ /// <summary>
/// Starts the grid.
/// </summary>
private static IIgnite StartGrid(string gridName = null)
http://git-wip-us.apache.org/repos/asf/ignite/blob/cc1aa533/modules/platforms/dotnet/Apache.Ignite.Core.Tests/FutureTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/FutureTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/FutureTest.cs
index 226d4b4..be5bbbc 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/FutureTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/FutureTest.cs
@@ -21,7 +21,6 @@ namespace Apache.Ignite.Core.Tests
using System.Collections.Generic;
using System.Threading;
using Apache.Ignite.Core.Cache;
- using Apache.Ignite.Core.Common;
using Apache.Ignite.Core.Compute;
using Apache.Ignite.Core.Portable;
using NUnit.Framework;
@@ -57,9 +56,9 @@ namespace Apache.Ignite.Core.Tests
}
});
- _cache = grid.GetCache<object, object>(null).WithAsync();
+ _cache = grid.GetCache<object, object>(null);
- _compute = grid.GetCompute().WithAsync();
+ _compute = grid.GetCompute();
}
/// <summary>
@@ -71,72 +70,19 @@ namespace Apache.Ignite.Core.Tests
TestUtils.KillProcesses();
}
- [Test]
- public void TestListen()
- {
- // Listen(Action callback)
- TestListen((fut, act) => fut.Listen(act));
-
- // Listen(Action<IFuture> callback)
- TestListen((fut, act) => ((IFuture)fut).Listen(f =>
- {
- Assert.AreEqual(f, fut);
- act();
- }));
-
- // Listen(Action<IFuture<T>> callback)
- TestListen((fut, act) => fut.Listen(f =>
- {
- Assert.AreEqual(f, fut);
- act();
- }));
- }
-
- private void TestListen(Action<IFuture<object>, Action> listenAction)
- {
- _compute.Broadcast(new SleepAction());
-
- var fut = _compute.GetFuture<object>();
-
- var listenCount = 0;
-
- // Multiple subscribers before completion
- for (var i = 0; i < 10; i++)
- listenAction(fut, () => Interlocked.Increment(ref listenCount));
-
- Assert.IsFalse(fut.IsDone);
-
- Assert.IsNull(fut.Get());
-
- Thread.Sleep(100); // wait for future completion thread
-
- Assert.AreEqual(10, listenCount);
-
- // Multiple subscribers after completion
- for (var i = 0; i < 10; i++)
- listenAction(fut, () => Interlocked.Decrement(ref listenCount));
-
- Assert.AreEqual(0, listenCount);
- }
[Test]
public void TestToTask()
{
- _cache.Put(1, 1);
-
- _cache.GetFuture().ToTask().Wait();
-
- _cache.Get(1);
+ _cache.PutAsync(1, 1).Wait();
- var task1 = _cache.GetFuture<int>().ToTask();
+ var task1 = _cache.GetAsync(1);
Assert.AreEqual(1, task1.Result);
Assert.IsTrue(task1.IsCompleted);
- _compute.Broadcast(new SleepAction());
-
- var task2 = _compute.GetFuture().ToTask();
+ var task2 = _compute.BroadcastAsync(new SleepAction());
Assert.IsFalse(task2.IsCompleted);
@@ -145,38 +91,6 @@ namespace Apache.Ignite.Core.Tests
task2.Wait();
Assert.IsTrue(task2.IsCompleted);
-
- Assert.AreEqual(null, task2.Result);
- }
-
- [Test]
- public void TestGetWithTimeout()
- {
- _compute.Broadcast(new SleepAction());
-
- var fut = _compute.GetFuture();
-
- Assert.Throws<TimeoutException>(() => fut.Get(TimeSpan.FromMilliseconds(100)));
-
- fut.Get(TimeSpan.FromSeconds(1));
-
- Assert.IsTrue(fut.IsDone);
- }
-
- [Test]
- public void TestToAsyncResult()
- {
- _compute.Broadcast(new SleepAction());
-
- IFuture fut = _compute.GetFuture();
-
- var asyncRes = fut.ToAsyncResult();
-
- Assert.IsFalse(asyncRes.IsCompleted);
-
- Assert.IsTrue(asyncRes.AsyncWaitHandle.WaitOne(1000));
-
- Assert.IsTrue(asyncRes.IsCompleted);
}
[Test]
@@ -203,13 +117,9 @@ namespace Apache.Ignite.Core.Tests
{
var key = typeof(T).Name;
- _cache.Put(key, value);
-
- _cache.GetFuture().Get();
-
- _cache.Get(key);
+ _cache.PutAsync(key, value).Wait();
- Assert.AreEqual(value, _cache.GetFuture<T>().Get());
+ Assert.AreEqual(value, _cache.GetAsync(key).Result);
}
/// <summary>
http://git-wip-us.apache.org/repos/asf/ignite/blob/cc1aa533/modules/platforms/dotnet/Apache.Ignite.Core.Tests/MessagingTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/MessagingTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/MessagingTest.cs
index 274c25e..e424426 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/MessagingTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/MessagingTest.cs
@@ -192,7 +192,7 @@ namespace Apache.Ignite.Core.Tests
var senders = Task.Factory.StartNew(() => TestUtils.RunMultiThreaded(() =>
{
- messaging.Send((object) NextMessage());
+ messaging.Send(NextMessage());
Thread.Sleep(50);
}, threadCnt, runSeconds));
@@ -252,7 +252,7 @@ namespace Apache.Ignite.Core.Tests
var sharedResult = Thread.VolatileRead(ref sharedReceived);
- messaging.Send((object)NextMessage());
+ messaging.Send(NextMessage());
Thread.Sleep(MessagingTestHelper.MessageTimeout);
@@ -285,15 +285,14 @@ namespace Apache.Ignite.Core.Tests
/// <summary>
/// Tests RemoteListen.
/// </summary>
- public void TestRemoteListen(object topic, bool async = false)
+ private void TestRemoteListen(object topic, bool async = false)
{
- var messaging = async ? _grid1.GetMessaging().WithAsync() : _grid1.GetMessaging();
+ var messaging =_grid1.GetMessaging();
var listener = MessagingTestHelper.GetListener();
- var listenId = messaging.RemoteListen(listener, topic);
-
- if (async)
- listenId = messaging.GetFuture<Guid>().Get();
+ var listenId = async
+ ? messaging.RemoteListenAsync(listener, topic).Result
+ : messaging.RemoteListen(listener, topic);
// Test sending
CheckSend(topic, msg: messaging, remoteListen: true);
@@ -302,17 +301,16 @@ namespace Apache.Ignite.Core.Tests
CheckNoMessage(NextId());
// Test multiple subscriptions for the same filter
- var listenId2 = messaging.RemoteListen(listener, topic);
-
- if (async)
- listenId2 = messaging.GetFuture<Guid>().Get();
+ var listenId2 = async
+ ? messaging.RemoteListenAsync(listener, topic).Result
+ : messaging.RemoteListen(listener, topic);
CheckSend(topic, msg: messaging, remoteListen: true, repeatMultiplier: 2); // expect twice the messages
- messaging.StopRemoteListen(listenId2);
-
if (async)
- messaging.GetFuture().Get();
+ messaging.StopRemoteListenAsync(listenId2).Wait();
+ else
+ messaging.StopRemoteListen(listenId2);
CheckSend(topic, msg: messaging, remoteListen: true); // back to normal after unsubscription
@@ -321,10 +319,10 @@ namespace Apache.Ignite.Core.Tests
Assert.AreEqual("Unable to cast object of type 'System.Double' to type 'System.String'.", ex.Message);
// Test end listen
- messaging.StopRemoteListen(listenId);
-
if (async)
- messaging.GetFuture().Get();
+ messaging.StopRemoteListenAsync(listenId).Wait();
+ else
+ messaging.StopRemoteListen(listenId);
CheckNoMessage(topic);
}
@@ -371,7 +369,7 @@ namespace Apache.Ignite.Core.Tests
var senders = Task.Factory.StartNew(() => TestUtils.RunMultiThreaded(() =>
{
MessagingTestHelper.ClearReceived(int.MaxValue);
- messaging.Send((object) NextMessage());
+ messaging.Send(NextMessage());
Thread.Sleep(50);
}, threadCnt, runSeconds));
@@ -390,7 +388,7 @@ namespace Apache.Ignite.Core.Tests
MessagingTestHelper.ListenResult = false;
- messaging.Send((object) NextMessage()); // send a message to make filters return false
+ messaging.Send(NextMessage()); // send a message to make filters return false
Thread.Sleep(MessagingTestHelper.MessageTimeout); // wait for all to unsubscribe
@@ -400,7 +398,7 @@ namespace Apache.Ignite.Core.Tests
var sharedResult = MessagingTestHelper.ReceivedMessages.Count;
- messaging.Send((object) NextMessage());
+ messaging.Send(NextMessage());
Thread.Sleep(MessagingTestHelper.MessageTimeout);
@@ -439,7 +437,7 @@ namespace Apache.Ignite.Core.Tests
// Single message
MessagingTestHelper.ClearReceived(expectedRepeat);
- msg.Send((object) messages[0], topic);
+ msg.Send(messages[0], topic);
MessagingTestHelper.VerifyReceive(cluster, messages.Take(1), m => m.ToList(), expectedRepeat);
if (single)
http://git-wip-us.apache.org/repos/asf/ignite/blob/cc1aa533/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Services/ServicesAsyncWrapper.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Services/ServicesAsyncWrapper.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Services/ServicesAsyncWrapper.cs
index ba45dbd..b5ff9c2 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Services/ServicesAsyncWrapper.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Services/ServicesAsyncWrapper.cs
@@ -17,10 +17,10 @@
namespace Apache.Ignite.Core.Tests.Services
{
+ using System;
using System.Collections.Generic;
- using System.Diagnostics;
+ using System.Threading.Tasks;
using Apache.Ignite.Core.Cluster;
- using Apache.Ignite.Core.Common;
using Apache.Ignite.Core.Services;
/// <summary>
@@ -37,88 +37,104 @@ namespace Apache.Ignite.Core.Tests.Services
/// <param name="services">Services to wrap.</param>
public ServicesAsyncWrapper(IServices services)
{
- _services = services.WithAsync();
+ _services = services;
}
/** <inheritDoc /> */
- public IServices WithAsync()
+ public IClusterGroup ClusterGroup
{
- return this;
+ get { return _services.ClusterGroup; }
}
/** <inheritDoc /> */
- public bool IsAsync
+ public void DeployClusterSingleton(string name, IService service)
{
- get { return true; }
+ _services.DeployClusterSingletonAsync(name, service).Wait();
}
/** <inheritDoc /> */
- public IFuture GetFuture()
+ public Task DeployClusterSingletonAsync(string name, IService service)
{
- Debug.Fail("ServicesAsyncWrapper.Future() should not be called. It always returns null.");
- return null;
+ return _services.DeployClusterSingletonAsync(name, service);
}
/** <inheritDoc /> */
- public IFuture<TResult> GetFuture<TResult>()
+ public void DeployNodeSingleton(string name, IService service)
{
- Debug.Fail("ServicesAsyncWrapper.Future() should not be called. It always returns null.");
- return null;
+ _services.DeployNodeSingletonAsync(name, service).Wait();
}
/** <inheritDoc /> */
- public IClusterGroup ClusterGroup
+ public Task DeployNodeSingletonAsync(string name, IService service)
{
- get { return _services.ClusterGroup; }
+ return _services.DeployNodeSingletonAsync(name, service);
}
/** <inheritDoc /> */
- public void DeployClusterSingleton(string name, IService service)
+ public void DeployKeyAffinitySingleton<TK>(string name, IService service, string cacheName, TK affinityKey)
{
- _services.DeployClusterSingleton(name, service);
- WaitResult();
+ _services.DeployKeyAffinitySingletonAsync(name, service, cacheName, affinityKey).Wait();
}
/** <inheritDoc /> */
- public void DeployNodeSingleton(string name, IService service)
+ public Task DeployKeyAffinitySingletonAsync<TK>(string name, IService service, string cacheName, TK affinityKey)
{
- _services.DeployNodeSingleton(name, service);
- WaitResult();
+ return _services.DeployKeyAffinitySingletonAsync(name, service, cacheName, affinityKey);
}
/** <inheritDoc /> */
- public void DeployKeyAffinitySingleton<TK>(string name, IService service, string cacheName, TK affinityKey)
+ public void DeployMultiple(string name, IService service, int totalCount, int maxPerNodeCount)
{
- _services.DeployKeyAffinitySingleton(name, service, cacheName, affinityKey);
- WaitResult();
+ try
+ {
+ _services.DeployMultipleAsync(name, service, totalCount, maxPerNodeCount).Wait();
+ }
+ catch (AggregateException ex)
+ {
+ throw ex.InnerException;
+ }
}
/** <inheritDoc /> */
- public void DeployMultiple(string name, IService service, int totalCount, int maxPerNodeCount)
+ public Task DeployMultipleAsync(string name, IService service, int totalCount, int maxPerNodeCount)
{
- _services.DeployMultiple(name, service, totalCount, maxPerNodeCount);
- WaitResult();
+ return _services.DeployMultipleAsync(name, service, totalCount, maxPerNodeCount);
}
/** <inheritDoc /> */
public void Deploy(ServiceConfiguration configuration)
{
- _services.Deploy(configuration);
- WaitResult();
+ _services.DeployAsync(configuration).Wait();
+ }
+
+ /** <inheritDoc /> */
+ public Task DeployAsync(ServiceConfiguration configuration)
+ {
+ return _services.DeployAsync(configuration);
}
/** <inheritDoc /> */
public void Cancel(string name)
{
- _services.Cancel(name);
- WaitResult();
+ _services.CancelAsync(name).Wait();
+ }
+
+ /** <inheritDoc /> */
+ public Task CancelAsync(string name)
+ {
+ return _services.CancelAsync(name);
}
/** <inheritDoc /> */
public void CancelAll()
{
- _services.CancelAll();
- WaitResult();
+ _services.CancelAllAsync().Wait();
+ }
+
+ /** <inheritDoc /> */
+ public Task CancelAllAsync()
+ {
+ return _services.CancelAllAsync();
}
/** <inheritDoc /> */
@@ -162,13 +178,5 @@ namespace Apache.Ignite.Core.Tests.Services
{
return new ServicesAsyncWrapper(_services.WithServerKeepPortable());
}
-
- /// <summary>
- /// Waits for the async result.
- /// </summary>
- private void WaitResult()
- {
- _services.GetFuture().Get();
- }
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/cc1aa533/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj b/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
index 04cbca1..5c2c6e7 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
@@ -91,8 +91,6 @@
<Compile Include="Cluster\IClusterNode.cs" />
<Compile Include="Cluster\IClusterNodeFilter.cs" />
<Compile Include="Common\IgniteException.cs" />
- <Compile Include="Common\IAsyncSupport.cs" />
- <Compile Include="Common\IFuture.cs" />
<Compile Include="Common\IgniteGuid.cs" />
<Compile Include="Compute\ComputeExecutionRejectedException.cs" />
<Compile Include="Compute\ComputeJobAdapter.cs" />
@@ -134,7 +132,6 @@
<Compile Include="GlobalSuppressions.cs" />
<Compile Include="IgniteConfiguration.cs" />
<Compile Include="Ignition.cs" />
- <Compile Include="Common\AsyncSupportedAttribute.cs" />
<Compile Include="IIgnite.cs" />
<Compile Include="Impl\Cache\CacheAffinityImpl.cs" />
<Compile Include="Impl\Cache\CacheEntry.cs" />
@@ -149,7 +146,6 @@
<Compile Include="Impl\Cache\CacheLock.cs" />
<Compile Include="Impl\Cache\CacheMetricsImpl.cs" />
<Compile Include="Impl\Cache\CacheOp.cs" />
- <Compile Include="Impl\Cache\CacheProxyImpl.cs" />
<Compile Include="Impl\Cache\Event\CacheEntryCreateEvent.cs" />
<Compile Include="Impl\Cache\Event\CacheEntryRemoveEvent.cs" />
<Compile Include="Impl\Cache\Event\CacheEntryUpdateEvent.cs" />
@@ -172,9 +168,7 @@
<Compile Include="Impl\Collections\MultiValueDictionary.cs" />
<Compile Include="Impl\Collections\ReadOnlyCollection.cs" />
<Compile Include="Impl\Collections\ReadOnlyDictionary.cs" />
- <Compile Include="Impl\Common\AsyncResult.cs" />
<Compile Include="Impl\Common\Classpath.cs" />
- <Compile Include="Impl\Common\CompletedAsyncResult.cs" />
<Compile Include="Impl\Common\CopyOnWriteConcurrentDictionary.cs" />
<Compile Include="Impl\Common\DelegateConverter.cs" />
<Compile Include="Impl\Common\DelegateTypeDescriptor.cs" />
@@ -196,7 +190,6 @@
<Compile Include="Impl\Compute\Closure\ComputeSingleClosureTask.cs" />
<Compile Include="Impl\Compute\Closure\IComputeResourceInjector.cs" />
<Compile Include="Impl\Compute\Compute.cs" />
- <Compile Include="Impl\Compute\ComputeAsync.cs" />
<Compile Include="Impl\Compute\ComputeFunc.cs" />
<Compile Include="Impl\Compute\ComputeImpl.cs" />
<Compile Include="Impl\Compute\ComputeJob.cs" />
@@ -212,7 +205,6 @@
<Compile Include="Impl\Datastream\StreamReceiverHolder.cs" />
<Compile Include="Impl\DataStructures\AtomicLong.cs" />
<Compile Include="Impl\Events\Events.cs" />
- <Compile Include="Impl\Events\EventsAsync.cs" />
<Compile Include="Impl\Events\RemoteListenEventFilter.cs" />
<Compile Include="Impl\ExceptionUtils.cs" />
<Compile Include="Impl\IgniteConfigurationEx.cs" />
@@ -241,7 +233,6 @@
<Compile Include="Impl\Memory\PlatformUnpooledMemory.cs" />
<Compile Include="Impl\Messaging\MessageListenerHolder.cs" />
<Compile Include="Impl\Messaging\Messaging.cs" />
- <Compile Include="Impl\Messaging\MessagingAsync.cs" />
<Compile Include="Impl\NativeMethods.cs" />
<Compile Include="Impl\Portable\DateTimeHolder.cs" />
<Compile Include="Impl\Portable\IO\IPortableStream.cs" />
@@ -294,8 +285,6 @@
<Compile Include="Impl\Services\ServiceProxyInvoker.cs" />
<Compile Include="Impl\Services\ServiceProxySerializer.cs" />
<Compile Include="Impl\Services\Services.cs" />
- <Compile Include="Impl\Services\ServicesAsync.cs" />
- <Compile Include="Impl\Transactions\AsyncTransaction.cs" />
<Compile Include="Impl\Transactions\Transaction.cs" />
<Compile Include="Impl\Transactions\TransactionImpl.cs" />
<Compile Include="Impl\Transactions\TransactionMetricsImpl.cs" />