You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by pt...@apache.org on 2018/04/13 10:38:26 UTC

[1/3] ignite git commit: IGNITE-8240 .NET: Use default scheduler when starting Tasks

Repository: ignite
Updated Branches:
  refs/heads/ignite-2.5 6a77dd8b1 -> 6072af825


IGNITE-8240 .NET: Use default scheduler when starting Tasks

This closes #3812


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

Branch: refs/heads/ignite-2.5
Commit: 687ae653bd66745c49ba9f85a169e27191ddc16c
Parents: 6a77dd8
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Fri Apr 13 12:28:19 2018 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Fri Apr 13 13:37:48 2018 +0300

----------------------------------------------------------------------
 .gitignore                                      |  1 +
 .../IgniteSessionStateStoreProviderTest.cs      |  7 +-
 .../Apache.Ignite.Benchmarks/BenchmarkRunner.cs |  1 -
 .../Binary/BinaryDynamicRegistrationTest.cs     |  2 +-
 .../Cache/CacheAbstractTransactionalTest.cs     |  5 +-
 .../Client/ClientConnectionTest.cs              |  3 +-
 .../Apache.Ignite.Core.Tests/EventsTest.cs      |  9 +--
 .../Apache.Ignite.Core.Tests/ExceptionsTest.cs  |  3 +-
 .../IgniteStartStopTest.cs                      |  5 +-
 .../Apache.Ignite.Core.Tests/MessagingTest.cs   |  5 +-
 .../Apache.Ignite.Core.csproj                   |  1 +
 .../Impl/Client/ClientSocket.cs                 |  6 +-
 .../Impl/Common/TaskRunner.cs                   | 70 ++++++++++++++++++++
 .../Impl/Datastream/DataStreamerBatch.cs        |  2 +-
 .../Impl/Datastream/DataStreamerImpl.cs         |  2 +-
 .../Apache.Ignite.Core/Impl/Events/Events.cs    |  2 +-
 .../Impl/Transactions/TransactionImpl.cs        |  3 +-
 17 files changed, 103 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/687ae653/.gitignore
----------------------------------------------------------------------
diff --git a/.gitignore b/.gitignore
index 535a8ff..47220b2 100644
--- a/.gitignore
+++ b/.gitignore
@@ -29,6 +29,7 @@ git-patch-prop-local.sh
 **/dotnet/libs/
 *.classname*
 *.exe
+.mvn/
 
 #Visual Studio files
 *.[Oo]bj

http://git-wip-us.apache.org/repos/asf/ignite/blob/687ae653/modules/platforms/dotnet/Apache.Ignite.AspNet.Tests/IgniteSessionStateStoreProviderTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.AspNet.Tests/IgniteSessionStateStoreProviderTest.cs b/modules/platforms/dotnet/Apache.Ignite.AspNet.Tests/IgniteSessionStateStoreProviderTest.cs
index 25700c6..08c44a6 100644
--- a/modules/platforms/dotnet/Apache.Ignite.AspNet.Tests/IgniteSessionStateStoreProviderTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.AspNet.Tests/IgniteSessionStateStoreProviderTest.cs
@@ -28,6 +28,7 @@ namespace Apache.Ignite.AspNet.Tests
     using System.Web.SessionState;
     using Apache.Ignite.Core;
     using Apache.Ignite.Core.Common;
+    using Apache.Ignite.Core.Impl.Common;
     using Apache.Ignite.Core.Tests;
     using NUnit.Framework;
 
@@ -265,7 +266,7 @@ namespace Apache.Ignite.AspNet.Tests
             Assert.AreEqual(SessionStateActions.None, actions);
 
             // Try to get it in a different thread.
-            Task.Factory.StartNew(() =>
+            TaskRunner.Run(() =>
             {
                 object lockId1;   // do not overwrite lockId
                 res = provider.GetItem(HttpContext, Id, out locked, out lockAge, out lockId1, out actions);
@@ -277,7 +278,7 @@ namespace Apache.Ignite.AspNet.Tests
             }).Wait();
 
             // Try to get it in a different thread.
-            Task.Factory.StartNew(() =>
+            TaskRunner.Run(() =>
             {
                 object lockId1;   // do not overwrite lockId
                 res = provider.GetItemExclusive(HttpContext, Id, out locked, out lockAge, out lockId1, out actions);
@@ -292,7 +293,7 @@ namespace Apache.Ignite.AspNet.Tests
             provider.ReleaseItemExclusive(HttpContext, Id, lockId);
 
             // Make sure it is accessible in a different thread.
-            Task.Factory.StartNew(() =>
+            TaskRunner.Run(() =>
             {
                 res = provider.GetItem(HttpContext, Id, out locked, out lockAge, out lockId, out actions);
                 Assert.IsNotNull(res);

http://git-wip-us.apache.org/repos/asf/ignite/blob/687ae653/modules/platforms/dotnet/Apache.Ignite.Benchmarks/BenchmarkRunner.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Benchmarks/BenchmarkRunner.cs b/modules/platforms/dotnet/Apache.Ignite.Benchmarks/BenchmarkRunner.cs
index e152ffb..fb2fbd2 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Benchmarks/BenchmarkRunner.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Benchmarks/BenchmarkRunner.cs
@@ -22,7 +22,6 @@ namespace Apache.Ignite.Benchmarks
     using System.IO;
     using System.Text;
     using Apache.Ignite.Benchmarks.Interop;
-    using Apache.Ignite.Benchmarks.ThinClient;
 
     /// <summary>
     /// Benchmark runner.

http://git-wip-us.apache.org/repos/asf/ignite/blob/687ae653/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryDynamicRegistrationTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryDynamicRegistrationTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryDynamicRegistrationTest.cs
index e635bd1..272a0ca 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryDynamicRegistrationTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryDynamicRegistrationTest.cs
@@ -399,7 +399,7 @@ namespace Apache.Ignite.Core.Tests.Binary
                         };
 
                         var tasks = Enumerable.Range(0, threads)
-                            .Select(x => Task.Factory.StartNew(registerType))
+                            .Select(x => TaskRunner.Run(registerType))
                             .ToArray();
 
                         Task.WaitAll(tasks);

http://git-wip-us.apache.org/repos/asf/ignite/blob/687ae653/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheAbstractTransactionalTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheAbstractTransactionalTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheAbstractTransactionalTest.cs
index 2602a02..3d0168c 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheAbstractTransactionalTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheAbstractTransactionalTest.cs
@@ -25,6 +25,7 @@ namespace Apache.Ignite.Core.Tests.Cache
     using System.Transactions;
     using Apache.Ignite.Core.Cache;
     using Apache.Ignite.Core.Cache.Configuration;
+    using Apache.Ignite.Core.Impl.Common;
     using Apache.Ignite.Core.Transactions;
     using NUnit.Framework;
 
@@ -563,8 +564,8 @@ namespace Apache.Ignite.Core.Tests.Cache
             var aex = Assert.Throws<AggregateException>(() =>
                 Task.WaitAll(new[]
                     {
-                        Task.Factory.StartNew(() => increment(keys0)),
-                        Task.Factory.StartNew(() => increment(keys0.Reverse().ToArray()))
+                        TaskRunner.Run(() => increment(keys0)),
+                        TaskRunner.Run(() => increment(keys0.Reverse().ToArray()))
                     },
                     TimeSpan.FromSeconds(40)));
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/687ae653/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Client/ClientConnectionTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Client/ClientConnectionTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Client/ClientConnectionTest.cs
index 2ea17a8..cb30f40 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Client/ClientConnectionTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Client/ClientConnectionTest.cs
@@ -31,6 +31,7 @@ namespace Apache.Ignite.Core.Tests.Client
     using Apache.Ignite.Core.Client;
     using Apache.Ignite.Core.Client.Cache;
     using Apache.Ignite.Core.Configuration;
+    using Apache.Ignite.Core.Impl.Common;
     using NUnit.Framework;
 
     /// <summary>
@@ -310,7 +311,7 @@ namespace Apache.Ignite.Core.Tests.Client
             var evt = new ManualResetEventSlim();
             var ignite = Ignition.Start(TestUtils.GetTestConfiguration());
 
-            var putGetTask = Task.Factory.StartNew(() =>
+            var putGetTask = TaskRunner.Run(() =>
             {
                 using (var client = StartClient())
                 {

http://git-wip-us.apache.org/repos/asf/ignite/blob/687ae653/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 a7c0534..e9bac02 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/EventsTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/EventsTest.cs
@@ -34,6 +34,7 @@ namespace Apache.Ignite.Core.Tests
     using Apache.Ignite.Core.Common;
     using Apache.Ignite.Core.Events;
     using Apache.Ignite.Core.Impl;
+    using Apache.Ignite.Core.Impl.Common;
     using Apache.Ignite.Core.Impl.Events;
     using Apache.Ignite.Core.Resource;
     using Apache.Ignite.Core.Tests.Compute;
@@ -385,14 +386,14 @@ namespace Apache.Ignite.Core.Tests
         /// </summary>
         private static IEnumerable<Func<IEventFilter<IEvent>, int[], Task<IEvent>>> GetWaitTasks(IEvents events)
         {
-            yield return (filter, types) => Task.Factory.StartNew(() => events.WaitForLocal(types));
-            yield return (filter, types) => Task.Factory.StartNew(() => events.WaitForLocal(types.ToList()));
+            yield return (filter, types) => TaskRunner.Run(() => events.WaitForLocal(types));
+            yield return (filter, types) => TaskRunner.Run(() => events.WaitForLocal(types.ToList()));
 
             yield return (filter, types) => events.WaitForLocalAsync(types);
             yield return (filter, types) => events.WaitForLocalAsync(types.ToList());
 
-            yield return (filter, types) => Task.Factory.StartNew(() => events.WaitForLocal(filter, types));
-            yield return (filter, types) => Task.Factory.StartNew(() => events.WaitForLocal(filter, types.ToList()));
+            yield return (filter, types) => TaskRunner.Run(() => events.WaitForLocal(filter, types));
+            yield return (filter, types) => TaskRunner.Run(() => events.WaitForLocal(filter, types.ToList()));
 
             yield return (filter, types) => events.WaitForLocalAsync(filter, types);
             yield return (filter, types) => events.WaitForLocalAsync(filter, types.ToList());

http://git-wip-us.apache.org/repos/asf/ignite/blob/687ae653/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 f7568ef..0b06ea3 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ExceptionsTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ExceptionsTest.cs
@@ -29,6 +29,7 @@ namespace Apache.Ignite.Core.Tests
     using Apache.Ignite.Core.Cluster;
     using Apache.Ignite.Core.Common;
     using Apache.Ignite.Core.Compute;
+    using Apache.Ignite.Core.Impl.Common;
     using Apache.Ignite.Core.Services;
     using Apache.Ignite.Core.Transactions;
     using NUnit.Framework;
@@ -348,7 +349,7 @@ namespace Apache.Ignite.Core.Tests
                     cache = cache.WithKeepBinary<TK, int>();
 
                 // Do cache puts in parallel
-                var putTask = Task.Factory.StartNew(() =>
+                var putTask = TaskRunner.Run(() =>
                 {
                     try
                     {

http://git-wip-us.apache.org/repos/asf/ignite/blob/687ae653/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteStartStopTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteStartStopTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteStartStopTest.cs
index 792b33d..f9c1cad 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteStartStopTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteStartStopTest.cs
@@ -23,6 +23,7 @@ namespace Apache.Ignite.Core.Tests
     using System.Threading;
     using System.Threading.Tasks;
     using Apache.Ignite.Core.Common;
+    using Apache.Ignite.Core.Impl.Common;
     using Apache.Ignite.Core.Messaging;
     using Apache.Ignite.Core.Tests.Process;
     using NUnit.Framework;
@@ -207,7 +208,7 @@ namespace Apache.Ignite.Core.Tests
 
                 if (i % 2 == 0) // Try to stop ignite from another thread.
                 {
-                    Task.Factory.StartNew(() => grid.Dispose()).Wait();
+                    TaskRunner.Run(() => grid.Dispose()).Wait();
                 }
                 else
                 {
@@ -306,7 +307,7 @@ namespace Apache.Ignite.Core.Tests
 
             // Spam message subscriptions on a separate thread 
             // to test race conditions during processor init on remote node
-            var listenTask = Task.Factory.StartNew(() =>
+            var listenTask = TaskRunner.Run(() =>
             {
                 var filter = new MessageListener();
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/687ae653/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 e644e31..7db4eef 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/MessagingTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/MessagingTest.cs
@@ -27,6 +27,7 @@ namespace Apache.Ignite.Core.Tests
     using Apache.Ignite.Core.Cache.Configuration;
     using Apache.Ignite.Core.Cluster;
     using Apache.Ignite.Core.Common;
+    using Apache.Ignite.Core.Impl.Common;
     using Apache.Ignite.Core.Messaging;
     using Apache.Ignite.Core.Resource;
     using Apache.Ignite.Core.Tests.Cache;
@@ -252,7 +253,7 @@ namespace Apache.Ignite.Core.Tests
 
             var messaging = _grid1.GetMessaging();
 
-            var senders = Task.Factory.StartNew(() => TestUtils.RunMultiThreaded(() =>
+            var senders = TaskRunner.Run(() => TestUtils.RunMultiThreaded(() =>
             {
                 messaging.Send(NextMessage());
                 Thread.Sleep(50);
@@ -423,7 +424,7 @@ namespace Apache.Ignite.Core.Tests
 
             var messaging = _grid1.GetMessaging();
 
-            var senders = Task.Factory.StartNew(() => TestUtils.RunMultiThreaded(() =>
+            var senders = TaskRunner.Run(() => TestUtils.RunMultiThreaded(() =>
             {
                 MessagingTestHelper.ClearReceived(int.MaxValue);
                 messaging.Send(NextMessage());

http://git-wip-us.apache.org/repos/asf/ignite/blob/687ae653/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 ec84a38..93c45c3 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
@@ -72,6 +72,7 @@
     <Compile Include="Client\IgniteClientException.cs" />
     <Compile Include="Client\IIgniteClient.cs" />
     <Compile Include="Common\ExceptionFactory.cs" />
+    <Compile Include="Impl\Common\TaskRunner.cs" />
     <Compile Include="Ssl\ISslContextFactory.cs" />
     <Compile Include="Configuration\Package-Info.cs" />
     <Compile Include="Configuration\ClientConnectorConfiguration.cs" />

http://git-wip-us.apache.org/repos/asf/ignite/blob/687ae653/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Client/ClientSocket.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Client/ClientSocket.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Client/ClientSocket.cs
index 27d8f0b..bce681f 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Client/ClientSocket.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Client/ClientSocket.cs
@@ -28,11 +28,11 @@ namespace Apache.Ignite.Core.Impl.Client
     using System.Net.Sockets;
     using System.Threading;
     using System.Threading.Tasks;
-    using System.Xml.Schema;
     using Apache.Ignite.Core.Client;
     using Apache.Ignite.Core.Common;
     using Apache.Ignite.Core.Impl.Binary;
     using Apache.Ignite.Core.Impl.Binary.IO;
+    using Apache.Ignite.Core.Impl.Common;
 
     /// <summary>
     /// Wrapper over framework socket for Ignite thin client operations.
@@ -117,7 +117,7 @@ namespace Apache.Ignite.Core.Impl.Client
             }
 
             // Continuously and asynchronously wait for data from server.
-            Task.Factory.StartNew(WaitForMessages);
+            TaskRunner.Run(WaitForMessages);
         }
 
         /// <summary>
@@ -174,7 +174,7 @@ namespace Apache.Ignite.Core.Impl.Client
             var task = SendRequestAsync(ref reqMsg);
 
             // Decode.
-            return task.ContinueWith(responseTask => DecodeResponse(responseTask.Result, readFunc, errorFunc));
+            return task.ContWith(responseTask => DecodeResponse(responseTask.Result, readFunc, errorFunc));
         }
 
         /// <summary>

http://git-wip-us.apache.org/repos/asf/ignite/blob/687ae653/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/TaskRunner.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/TaskRunner.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/TaskRunner.cs
new file mode 100644
index 0000000..51a7c6a
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/TaskRunner.cs
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+namespace Apache.Ignite.Core.Impl.Common
+{
+    using System;
+    using System.Threading;
+    using System.Threading.Tasks;
+
+    /// <summary>
+    /// Extensions for <see cref="Task"/> classes.
+    /// Fixes the issue with <see cref="TaskScheduler.Current"/> being used by defaut by system APIs.
+    /// </summary>
+    internal static class TaskRunner
+    {
+        /// <summary>
+        /// ContinueWith using default scheduler.
+        /// </summary>
+        public static Task<TNewResult> ContWith<TResult, TNewResult>(this Task<TResult> task,
+            Func<Task<TResult>, TNewResult> continuationFunction)
+        {
+            IgniteArgumentCheck.NotNull(task, "task");
+            
+            return task.ContinueWith(continuationFunction, TaskScheduler.Default);
+        }
+        
+        /// <summary>
+        /// ContinueWith using default scheduler.
+        /// </summary>
+        public static Task ContWith(this Task task,
+            Action<Task> continuationFunction)
+        {
+            IgniteArgumentCheck.NotNull(task, "task");
+            
+            return task.ContinueWith(continuationFunction, TaskScheduler.Default);
+        }
+
+        /// <summary>
+        /// Run new task using default scheduler.
+        /// </summary>
+        public static Task Run(Action action)
+        {
+            return Task.Factory.StartNew(action, CancellationToken.None, TaskCreationOptions.None, 
+                TaskScheduler.Default);
+        }
+        
+        /// <summary>
+        /// Run new task using default scheduler.
+        /// </summary>
+        public static Task<TResult> Run<TResult>(Func<TResult> func)
+        {
+            return Task.Factory.StartNew(func, CancellationToken.None, TaskCreationOptions.None, 
+                TaskScheduler.Default);
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/687ae653/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Datastream/DataStreamerBatch.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Datastream/DataStreamerBatch.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Datastream/DataStreamerBatch.cs
index 38a8ea8..0026701 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Datastream/DataStreamerBatch.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Datastream/DataStreamerBatch.cs
@@ -69,7 +69,7 @@ namespace Apache.Ignite.Core.Impl.Datastream
             if (prev != null)
                 Thread.MemoryBarrier(); // Prevent "prev" field escape.
 
-            _fut.Task.ContinueWith(x => ParentsCompleted());
+            _fut.Task.ContWith(x => ParentsCompleted());
         }
 
         /// <summary>

http://git-wip-us.apache.org/repos/asf/ignite/blob/687ae653/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Datastream/DataStreamerImpl.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Datastream/DataStreamerImpl.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Datastream/DataStreamerImpl.cs
index 555c6e6..7aaa84a 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Datastream/DataStreamerImpl.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Datastream/DataStreamerImpl.cs
@@ -897,7 +897,7 @@ namespace Apache.Ignite.Core.Impl.Datastream
             /// </summary>
             public void RunThread()
             {
-                Task.Factory.StartNew(Run);
+                TaskRunner.Run(Run);
             }
         }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/687ae653/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Events/Events.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Events/Events.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Events/Events.cs
index a81523a..04cc210 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Events/Events.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Events/Events.cs
@@ -241,7 +241,7 @@ namespace Apache.Ignite.Core.Impl.Events
                 if (hnd != null)
                 {
                     // Dispose handle as soon as future ends.
-                    task.ContinueWith(x => Ignite.HandleRegistry.Release(hnd.Value));
+                    task.ContWith(x => Ignite.HandleRegistry.Release(hnd.Value));
                 }
 
                 return task;

http://git-wip-us.apache.org/repos/asf/ignite/blob/687ae653/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Transactions/TransactionImpl.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Transactions/TransactionImpl.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Transactions/TransactionImpl.cs
index 0b04a68..c800859 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Transactions/TransactionImpl.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Transactions/TransactionImpl.cs
@@ -21,6 +21,7 @@ namespace Apache.Ignite.Core.Impl.Transactions
     using System.Globalization;
     using System.Threading;
     using System.Threading.Tasks;
+    using Apache.Ignite.Core.Impl.Common;
     using Apache.Ignite.Core.Transactions;
 
     /// <summary>
@@ -457,7 +458,7 @@ namespace Apache.Ignite.Core.Impl.Transactions
         /// </summary>
         private Task CloseWhenComplete(Task task)
         {
-            return task.ContinueWith(x => Close());
+            return task.ContWith(x => Close());
         }
 
         /** <inheritdoc /> */


[3/3] ignite git commit: IGNITE-8042: .NET: Thin client: authentication support - fix TestAuthenticationEmptyCredentials

Posted by pt...@apache.org.
IGNITE-8042: .NET: Thin client: authentication support - fix TestAuthenticationEmptyCredentials


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

Branch: refs/heads/ignite-2.5
Commit: 6072af825ca1507ad9d8143ca73e556539960e1d
Parents: 0a64e4a
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Fri Apr 13 13:36:20 2018 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Fri Apr 13 13:38:14 2018 +0300

----------------------------------------------------------------------
 .../dotnet/Apache.Ignite.Core.Tests/Client/ClientConnectionTest.cs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/6072af82/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Client/ClientConnectionTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Client/ClientConnectionTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Client/ClientConnectionTest.cs
index 0a6b1a7..67d1c52 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Client/ClientConnectionTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Client/ClientConnectionTest.cs
@@ -100,7 +100,7 @@ namespace Apache.Ignite.Core.Tests.Client
 
                 cliCfg.UserName = null;
                 ex = Assert.Throws<IgniteClientException>(() => { Ignition.StartClient(cliCfg); });
-                Assert.IsTrue(ex.Message.StartsWith("IgniteClientConfiguration.Username cannot be null"));
+                Assert.IsTrue(ex.Message.StartsWith("IgniteClientConfiguration.UserName cannot be null"));
 
                 cliCfg.UserName = "";
                 ex = Assert.Throws<IgniteClientException>(() => { Ignition.StartClient(cliCfg); });


[2/3] ignite git commit: IGNITE-8042: .NET: Thin client: authentication support - fix naming and inspections

Posted by pt...@apache.org.
IGNITE-8042: .NET: Thin client: authentication support - fix naming and inspections


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

Branch: refs/heads/ignite-2.5
Commit: 0a64e4affae9ec2e16c3a99128985f6bd9c788cb
Parents: 687ae65
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Fri Apr 13 12:44:17 2018 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Fri Apr 13 13:38:01 2018 +0300

----------------------------------------------------------------------
 .../Client/ClientConnectionTest.cs                    | 12 ++++++------
 .../Client/IgniteClientConfiguration.cs               |  4 ++--
 .../IgniteClientConfigurationSection.xsd              |  2 +-
 .../Apache.Ignite.Core/Impl/Client/ClientSocket.cs    | 14 +++++++-------
 4 files changed, 16 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/0a64e4af/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Client/ClientConnectionTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Client/ClientConnectionTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Client/ClientConnectionTest.cs
index cb30f40..0a6b1a7 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Client/ClientConnectionTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Client/ClientConnectionTest.cs
@@ -98,11 +98,11 @@ namespace Apache.Ignite.Core.Tests.Client
 
                 cliCfg.Password = "ignite";
 
-                cliCfg.Username = null;
+                cliCfg.UserName = null;
                 ex = Assert.Throws<IgniteClientException>(() => { Ignition.StartClient(cliCfg); });
                 Assert.IsTrue(ex.Message.StartsWith("IgniteClientConfiguration.Username cannot be null"));
 
-                cliCfg.Username = "";
+                cliCfg.UserName = "";
                 ex = Assert.Throws<IgniteClientException>(() => { Ignition.StartClient(cliCfg); });
                 Assert.IsTrue(ex.Message.StartsWith("IgniteClientConfiguration.Username cannot be empty"));
             }
@@ -118,12 +118,12 @@ namespace Apache.Ignite.Core.Tests.Client
             {
                 var cliCfg = SecureClientConfig();
 
-                cliCfg.Username = "invalid";
+                cliCfg.UserName = "invalid";
 
                 var ex = Assert.Throws<IgniteClientException>(() => { Ignition.StartClient(cliCfg); });
                 Assert.True(ex.StatusCode == ClientStatusCode.AuthenticationFailed);
 
-                cliCfg.Username = "ignite";
+                cliCfg.UserName = "ignite";
                 cliCfg.Password = "invalid";
 
                 ex = Assert.Throws<IgniteClientException>(() => { Ignition.StartClient(cliCfg); });
@@ -165,7 +165,7 @@ namespace Apache.Ignite.Core.Tests.Client
 
                 var cliCfg = SecureClientConfig();
 
-                cliCfg.Username = "my_User";
+                cliCfg.UserName = "my_User";
                 cliCfg.Password = "my_Password";
 
                 using (var cli = Ignition.StartClient(cliCfg))
@@ -532,7 +532,7 @@ namespace Apache.Ignite.Core.Tests.Client
             return new IgniteClientConfiguration()
             {
                 Host = "localhost",
-                Username = "ignite",
+                UserName = "ignite",
                 Password = "ignite"
             };
         }

http://git-wip-us.apache.org/repos/asf/ignite/blob/0a64e4af/modules/platforms/dotnet/Apache.Ignite.Core/Client/IgniteClientConfiguration.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Client/IgniteClientConfiguration.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Client/IgniteClientConfiguration.cs
index 3252495..80f26cf 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Client/IgniteClientConfiguration.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Client/IgniteClientConfiguration.cs
@@ -91,7 +91,7 @@ namespace Apache.Ignite.Core.Client
             BinaryProcessor = cfg.BinaryProcessor;
             SslStreamFactory = cfg.SslStreamFactory;
 
-            Username = cfg.Username;
+            UserName = cfg.UserName;
             Password = cfg.Password;
         }
 
@@ -151,7 +151,7 @@ namespace Apache.Ignite.Core.Client
         /// <summary>
         /// Username to be used to connect to secured cluster.
         /// </summary>
-        public string Username { get; set; }
+        public string UserName { get; set; }
 
         /// <summary>
         /// Password to be used to connect to secured cluster.

http://git-wip-us.apache.org/repos/asf/ignite/blob/0a64e4af/modules/platforms/dotnet/Apache.Ignite.Core/IgniteClientConfigurationSection.xsd
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/IgniteClientConfigurationSection.xsd b/modules/platforms/dotnet/Apache.Ignite.Core/IgniteClientConfigurationSection.xsd
index 7e6caff..b9a04b8 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/IgniteClientConfigurationSection.xsd
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/IgniteClientConfigurationSection.xsd
@@ -237,7 +237,7 @@
                     <xs:documentation>Socket operation timeout. Zero or negative for infinite timeout.</xs:documentation>
                 </xs:annotation>
             </xs:attribute>
-            <xs:attribute name="username" type="xs:string">
+            <xs:attribute name="userName" type="xs:string">
                 <xs:annotation>
                     <xs:documentation>Username to be used to connect to secured cluster.</xs:documentation>
                 </xs:annotation>

http://git-wip-us.apache.org/repos/asf/ignite/blob/0a64e4af/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Client/ClientSocket.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Client/ClientSocket.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Client/ClientSocket.cs
index bce681f..11d7942 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Client/ClientSocket.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Client/ClientSocket.cs
@@ -124,11 +124,11 @@ namespace Apache.Ignite.Core.Impl.Client
         /// Validate configuration.
         /// </summary>
         /// <param name="cfg">Configuration.</param>
-        private void Validate(IgniteClientConfiguration cfg)
+        private static void Validate(IgniteClientConfiguration cfg)
         {
-            if (cfg.Username != null)
+            if (cfg.UserName != null)
             {
-                if (cfg.Username.Length == 0)
+                if (cfg.UserName.Length == 0)
                     throw new IgniteClientException("IgniteClientConfiguration.Username cannot be empty.");
 
                 if (cfg.Password == null)
@@ -140,8 +140,8 @@ namespace Apache.Ignite.Core.Impl.Client
                 if (cfg.Password.Length == 0)
                     throw new IgniteClientException("IgniteClientConfiguration.Password cannot be empty.");
 
-                if (cfg.Username == null)
-                    throw new IgniteClientException("IgniteClientConfiguration.Username cannot be null when Password is set.");
+                if (cfg.UserName == null)
+                    throw new IgniteClientException("IgniteClientConfiguration.UserName cannot be null when Password is set.");
             }
         }
 
@@ -262,7 +262,7 @@ namespace Apache.Ignite.Core.Impl.Client
         /// </summary>
         private void Handshake(IgniteClientConfiguration clientConfiguration, ClientProtocolVersion version)
         {
-            bool auth = version.CompareTo(Ver110) >= 0 && clientConfiguration.Username != null;
+            bool auth = version.CompareTo(Ver110) >= 0 && clientConfiguration.UserName != null;
 
             // Send request.
             int messageLen;
@@ -284,7 +284,7 @@ namespace Apache.Ignite.Core.Impl.Client
                 {
                     var writer = BinaryUtils.Marshaller.StartMarshal(stream);
 
-                    writer.WriteString(clientConfiguration.Username);
+                    writer.WriteString(clientConfiguration.UserName);
                     writer.WriteString(clientConfiguration.Password);
 
                     BinaryUtils.Marshaller.FinishMarshal(writer);