IGNITE-1572: .Net: Removed unnecessary wrappers.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/9d67c20c Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/9d67c20c Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/9d67c20c Branch: refs/heads/ignite-950-new Commit: 9d67c20c852455e767c49588956f255cc9a0a317 Parents: f8b18cc Author: Pavel Tupitsyn <[email protected]> Authored: Fri Oct 23 12:42:30 2015 +0300 Committer: vozerov-gridgain <[email protected]> Committed: Fri Oct 23 12:42:30 2015 +0300 ---------------------------------------------------------------------- .../Interop/TaskBenchmark.cs | 2 +- .../Cache/CacheAbstractTest.cs | 25 +++- .../Continuous/ContinuousQueryAbstractTest.cs | 2 +- .../Compute/ComputeApiTest.cs | 4 +- .../Compute/ComputeMultithreadedTest.cs | 4 +- .../Compute/FailoverTaskSelfTest.cs | 2 +- .../Compute/IgniteExceptionTaskSelfTest.cs | 11 +- .../Compute/PortableTaskTest.cs | 60 +++++---- .../Compute/ResourceTaskTest.cs | 8 +- .../Compute/TaskAdapterTest.cs | 4 +- .../Compute/TaskResultTest.cs | 6 +- .../Examples/PathUtil.cs | 1 - .../IgniteManagerTest.cs | 1 - .../Process/IgniteProcess.cs | 1 - .../SerializationTest.cs | 4 +- .../Apache.Ignite.Core.csproj | 2 - .../Compute/ComputeJobAdapter.cs | 2 +- .../Compute/ComputeJobResultPolicy.cs | 2 +- .../Compute/ComputeTaskAdapter.cs | 4 +- .../ComputeTaskNoResultCacheAttribute.cs | 2 +- .../Apache.Ignite.Core/Compute/IComputeJob.cs | 4 +- .../Compute/IComputeJobResult.cs | 25 ++-- .../Apache.Ignite.Core/Compute/IComputeTask.cs | 2 +- .../Datastream/StreamTransformer.cs | 2 +- .../Impl/Cache/CacheEntryFilterHolder.cs | 4 +- .../Impl/Cache/CacheEntryProcessorHolder.cs | 8 +- .../Cache/CacheEntryProcessorResultHolder.cs | 3 +- .../Apache.Ignite.Core/Impl/Cache/CacheImpl.cs | 13 +- .../Continuous/ContinuousQueryFilterHolder.cs | 7 +- .../Impl/Common/PortableResultWrapper.cs | 67 ---------- .../Closure/ComputeAbstractClosureTask.cs | 4 +- .../Impl/Compute/Closure/ComputeActionJob.cs | 4 +- .../Impl/Compute/Closure/ComputeFuncJob.cs | 10 +- .../Compute/Closure/ComputeMultiClosureTask.cs | 2 +- .../Impl/Compute/Closure/ComputeOutFuncJob.cs | 4 +- .../Closure/ComputeReducingClosureTask.cs | 2 +- .../Compute/Closure/ComputeSingleClosureTask.cs | 2 +- .../Impl/Compute/ComputeFunc.cs | 4 +- .../Impl/Compute/ComputeJob.cs | 4 +- .../Impl/Compute/ComputeJobHolder.cs | 6 +- .../Compute/ComputeJobResultGenericWrapper.cs | 15 ++- .../Impl/Compute/ComputeJobResultImpl.cs | 15 ++- .../Impl/Compute/ComputeOutFunc.cs | 4 +- .../Impl/Compute/ComputeTaskHolder.cs | 20 +-- .../Impl/Datastream/StreamReceiverHolder.cs | 6 +- .../Apache.Ignite.Core/Impl/Events/Events.cs | 4 +- .../Impl/Events/RemoteListenEventFilter.cs | 3 +- .../Impl/Messaging/MessageListenerHolder.cs | 4 +- .../Impl/Portable/PortableMarshaller.cs | 3 - .../PortableOrSerializableObjectHolder.cs | 64 ---------- .../Impl/Portable/PortableUtils.cs | 128 +------------------ .../Impl/Portable/SerializableObjectHolder.cs | 13 +- .../Impl/Services/Services.cs | 4 +- .../Impl/Unmanaged/UnmanagedCallbacks.cs | 2 +- .../Portable/IPortableBuilder.cs | 2 - .../Compute/AverageSalaryTask.cs | 2 +- 56 files changed, 189 insertions(+), 424 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/9d67c20c/modules/platforms/dotnet/Apache.Ignite.Benchmarks/Interop/TaskBenchmark.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Benchmarks/Interop/TaskBenchmark.cs b/modules/platforms/dotnet/Apache.Ignite.Benchmarks/Interop/TaskBenchmark.cs index 6a2585c..0312f95 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Benchmarks/Interop/TaskBenchmark.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Benchmarks/Interop/TaskBenchmark.cs @@ -56,7 +56,7 @@ namespace Apache.Ignite.Benchmarks.Interop } /** <inheritDoc /> */ - public ComputeJobResultPolicy Result(IComputeJobResult<object> res, IList<IComputeJobResult<object>> rcvd) + public ComputeJobResultPolicy OnResult(IComputeJobResult<object> res, IList<IComputeJobResult<object>> rcvd) { return ComputeJobResultPolicy.Wait; } http://git-wip-us.apache.org/repos/asf/ignite/blob/9d67c20c/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 94ec2d6..19ea37d 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheAbstractTest.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheAbstractTest.cs @@ -21,7 +21,6 @@ namespace Apache.Ignite.Core.Tests.Cache using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Linq; - using System.Runtime.Serialization; using System.Text; using System.Threading; using System.Threading.Tasks; @@ -2828,6 +2827,22 @@ namespace Apache.Ignite.Core.Tests.Cache } [Test] + public void TestSerializableKeepPortable() + { + var cache = Cache<int, TestSerializableObject>(); + + var obj = new TestSerializableObject {Name = "Vasya", Id = 128}; + + cache.Put(1, obj); + + var portableResult = cache.WithKeepPortable<int, IPortableObject>().Get(1); + + var resultObj = portableResult.Deserialize<TestSerializableObject>(); + + Assert.AreEqual(obj, resultObj); + } + + [Test] public void TestInvoke() { TestInvoke(false); @@ -2849,7 +2864,7 @@ namespace Apache.Ignite.Core.Tests.Cache TestInvoke<NonSerializableCacheEntryProcessor>(async); Assert.Fail(); } - catch (SerializationException) + catch (PortableException) { // Expected } @@ -2884,7 +2899,7 @@ namespace Apache.Ignite.Core.Tests.Cache AssertThrowsCacheEntryProcessorException( () => cache.Invoke(key, new T {ThrowErrPortable = true}, arg)); AssertThrowsCacheEntryProcessorException( - () => cache.Invoke(key, new T { ThrowErrNonSerializable = true }, arg), "SerializationException"); + () => cache.Invoke(key, new T { ThrowErrNonSerializable = true }, arg), "PortableException"); } private static void AssertThrowsCacheEntryProcessorException(Action action, string containsText = null) @@ -2930,7 +2945,7 @@ namespace Apache.Ignite.Core.Tests.Cache TestInvokeAll<NonSerializableCacheEntryProcessor>(async, i); Assert.Fail(); } - catch (SerializationException) + catch (PortableException) { // Expected } @@ -2978,7 +2993,7 @@ namespace Apache.Ignite.Core.Tests.Cache TestInvokeAllException(cache, entries, new T { ThrowErrPortable = true, ThrowOnKey = errKey }, arg, errKey); TestInvokeAllException(cache, entries, new T { ThrowErrNonSerializable = true, ThrowOnKey = errKey }, - arg, errKey, "SerializationException"); + arg, errKey, "PortableException"); } http://git-wip-us.apache.org/repos/asf/ignite/blob/9d67c20c/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/Continuous/ContinuousQueryAbstractTest.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/Continuous/ContinuousQueryAbstractTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/Continuous/ContinuousQueryAbstractTest.cs index e0dcdaa..c4d2b36 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/Continuous/ContinuousQueryAbstractTest.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/Continuous/ContinuousQueryAbstractTest.cs @@ -491,7 +491,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Continuous } else { - Assert.Throws<SerializationException>(() => + Assert.Throws<PortableException>(() => { using (cache1.QueryContinuous(qry)) { http://git-wip-us.apache.org/repos/asf/ignite/blob/9d67c20c/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 4c451e7..b0388cd 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/ComputeApiTest.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/ComputeApiTest.cs @@ -1153,7 +1153,7 @@ namespace Apache.Ignite.Core.Tests.Compute } /** <inheritDoc /> */ - public ComputeJobResultPolicy Result(IComputeJobResult<NetSimpleJobResult> res, + public ComputeJobResultPolicy OnResult(IComputeJobResult<NetSimpleJobResult> res, IList<IComputeJobResult<NetSimpleJobResult>> rcvd) { return ComputeJobResultPolicy.Wait; @@ -1162,7 +1162,7 @@ namespace Apache.Ignite.Core.Tests.Compute /** <inheritDoc /> */ public NetSimpleTaskResult Reduce(IList<IComputeJobResult<NetSimpleJobResult>> results) { - return new NetSimpleTaskResult(results.Sum(res => res.Data().Res)); + return new NetSimpleTaskResult(results.Sum(res => res.Data.Res)); } } http://git-wip-us.apache.org/repos/asf/ignite/blob/9d67c20c/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/ComputeMultithreadedTest.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/ComputeMultithreadedTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/ComputeMultithreadedTest.cs index 5b6874f..b03d4a4 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/ComputeMultithreadedTest.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/ComputeMultithreadedTest.cs @@ -207,7 +207,7 @@ namespace Apache.Ignite.Core.Tests.Compute } /** <inheritDoc /> */ - public ComputeJobResultPolicy Result(IComputeJobResult<int> res, IList<IComputeJobResult<int>> rcvd) + public ComputeJobResultPolicy OnResult(IComputeJobResult<int> res, IList<IComputeJobResult<int>> rcvd) { return ComputeJobResultPolicy.Wait; } @@ -215,7 +215,7 @@ namespace Apache.Ignite.Core.Tests.Compute /** <inheritDoc /> */ public int Reduce(IList<IComputeJobResult<int>> results) { - return results.Count == 0 ? 0 : results[0].Data(); + return results.Count == 0 ? 0 : results[0].Data; } } http://git-wip-us.apache.org/repos/asf/ignite/blob/9d67c20c/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/FailoverTaskSelfTest.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/FailoverTaskSelfTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/FailoverTaskSelfTest.cs index e46ec64..2bd8e3a 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/FailoverTaskSelfTest.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/FailoverTaskSelfTest.cs @@ -161,7 +161,7 @@ namespace Apache.Ignite.Core.Tests.Compute { Assert.AreEqual(1, results.Count); - return results[0].Data(); + return results[0].Data; } } http://git-wip-us.apache.org/repos/asf/ignite/blob/9d67c20c/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/IgniteExceptionTaskSelfTest.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/IgniteExceptionTaskSelfTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/IgniteExceptionTaskSelfTest.cs index 62f860d..31286fe 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/IgniteExceptionTaskSelfTest.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/IgniteExceptionTaskSelfTest.cs @@ -24,6 +24,7 @@ namespace Apache.Ignite.Core.Tests.Compute using Apache.Ignite.Core.Cluster; using Apache.Ignite.Core.Common; using Apache.Ignite.Core.Compute; + using Apache.Ignite.Core.Portable; using Apache.Ignite.Core.Resource; using NUnit.Framework; @@ -87,7 +88,7 @@ namespace Apache.Ignite.Core.Tests.Compute { Mode = ErrorMode.MapJobNotMarshalable; - SerializationException e = ExecuteWithError() as SerializationException; + var e = ExecuteWithError() as PortableException; Assert.IsNotNull(e); } @@ -435,13 +436,13 @@ namespace Apache.Ignite.Core.Tests.Compute } /** <inheritDoc /> */ - public ComputeJobResultPolicy Result(IComputeJobResult<object> res, IList<IComputeJobResult<object>> rcvd) + public ComputeJobResultPolicy OnResult(IComputeJobResult<object> res, IList<IComputeJobResult<object>> rcvd) { - if (res.Exception() != null) - JobErrs.Add(res.Exception()); + if (res.Exception != null) + JobErrs.Add(res.Exception); else { - object res0 = res.Data(); + object res0 = res.Data; bool rmt = res0 is GoodJobResult ? ((GoodJobResult)res0).Rmt : ((BadJobResult)res0).Rmt; http://git-wip-us.apache.org/repos/asf/ignite/blob/9d67c20c/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/PortableTaskTest.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/PortableTaskTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/PortableTaskTest.cs index 736aa61..c63b4f0 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/PortableTaskTest.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/PortableTaskTest.cs @@ -46,11 +46,11 @@ namespace Apache.Ignite.Core.Tests.Compute [Test] public void TestPortableObjectInTask() { - IPortableObject taskArg = ToPortable(Grid1, new PortableTaskArgument(100)); + var taskArg = new PortableWrapper {Item = ToPortable(Grid1, new PortableTaskArgument(100))}; TestTask task = new TestTask(Grid1, taskArg); - IPortableObject res = Grid1.GetCompute().Execute(task, taskArg); + var res = Grid1.GetCompute().Execute(task, taskArg).Item; Assert.NotNull(res); @@ -78,46 +78,48 @@ namespace Apache.Ignite.Core.Tests.Compute portTypeCfgs.Add(new PortableTypeConfiguration(typeof(PortableTaskArgument))); portTypeCfgs.Add(new PortableTypeConfiguration(typeof(PortableTaskResult))); portTypeCfgs.Add(new PortableTypeConfiguration(typeof(PortableJob))); + portTypeCfgs.Add(new PortableTypeConfiguration(typeof(PortableWrapper))); } /// <summary> /// Test task. /// </summary> - public class TestTask : ComputeTaskAdapter<IPortableObject, IPortableObject, IPortableObject> + class TestTask : ComputeTaskAdapter<PortableWrapper, PortableWrapper, PortableWrapper> { /** */ private readonly IIgnite _grid; - private readonly IPortableObject _taskArgField; + private readonly PortableWrapper _taskArgField; - public TestTask(IIgnite grid, IPortableObject taskArgField) + public TestTask(IIgnite grid, PortableWrapper taskArgField) { _grid = grid; _taskArgField = taskArgField; } /** <inheritDoc /> */ - override public IDictionary<IComputeJob<IPortableObject>, IClusterNode> Map(IList<IClusterNode> subgrid, IPortableObject arg) + override public IDictionary<IComputeJob<PortableWrapper>, IClusterNode> Map(IList<IClusterNode> subgrid, PortableWrapper arg) { Assert.AreEqual(3, subgrid.Count); Assert.NotNull(_grid); - IPortableObject taskArg = arg; + var taskArg = arg; CheckTaskArgument(taskArg); CheckTaskArgument(_taskArgField); - IDictionary<IComputeJob<IPortableObject>, IClusterNode> jobs = new Dictionary<IComputeJob<IPortableObject>, IClusterNode>(); + var jobs = new Dictionary<IComputeJob<PortableWrapper>, IClusterNode>(); foreach (IClusterNode node in subgrid) { if (!Grid3Name.Equals(node.GetAttribute<string>("org.apache.ignite.ignite.name"))) // Grid3 does not have cache. { - PortableJob job = new PortableJob(); - - job.Arg = ToPortable(_grid, new PortableJobArgument(200)); + var job = new PortableJob + { + Arg = new PortableWrapper {Item = ToPortable(_grid, new PortableJobArgument(200))} + }; jobs.Add(job, node); } @@ -128,8 +130,12 @@ namespace Apache.Ignite.Core.Tests.Compute return jobs; } - private void CheckTaskArgument(IPortableObject taskArg) + private void CheckTaskArgument(PortableWrapper arg) { + Assert.IsNotNull(arg); + + var taskArg = arg.Item; + Assert.IsNotNull(taskArg); Assert.AreEqual(100, taskArg.GetField<int>("val")); @@ -140,15 +146,15 @@ namespace Apache.Ignite.Core.Tests.Compute } /** <inheritDoc /> */ - override public IPortableObject Reduce(IList<IComputeJobResult<IPortableObject>> results) + override public PortableWrapper Reduce(IList<IComputeJobResult<PortableWrapper>> results) { Assert.NotNull(_grid); Assert.AreEqual(2, results.Count); - foreach (IComputeJobResult<IPortableObject> res in results) + foreach (var res in results) { - IPortableObject jobRes = res.Data(); + var jobRes = res.Data.Item; Assert.NotNull(jobRes); @@ -159,7 +165,7 @@ namespace Apache.Ignite.Core.Tests.Compute Assert.AreEqual(300, jobResObj.Val); } - return ToPortable(_grid, new PortableTaskResult(400)); + return new PortableWrapper {Item = ToPortable(_grid, new PortableTaskResult(400))}; } } @@ -222,26 +228,31 @@ namespace Apache.Ignite.Core.Tests.Compute /// <summary> /// /// </summary> - class PortableJob : IComputeJob<IPortableObject> + class PortableJob : IComputeJob<PortableWrapper> { [InstanceResource] private IIgnite _grid = null; /** */ - public IPortableObject Arg; + public PortableWrapper Arg; /** <inheritDoc /> */ - public IPortableObject Execute() + + public PortableWrapper Execute() { Assert.IsNotNull(Arg); - Assert.AreEqual(200, Arg.GetField<int>("val")); + var arg = Arg.Item; + + Assert.IsNotNull(arg); - PortableJobArgument argObj = Arg.Deserialize<PortableJobArgument>(); + Assert.AreEqual(200, arg.GetField<int>("val")); + + PortableJobArgument argObj = arg.Deserialize<PortableJobArgument>(); Assert.AreEqual(200, argObj.Val); - return ToPortable(_grid, new PortableJobResult(300)); + return new PortableWrapper {Item = ToPortable(_grid, new PortableJobResult(300))}; } public void Cancel() @@ -249,5 +260,10 @@ namespace Apache.Ignite.Core.Tests.Compute // No-op. } } + + class PortableWrapper + { + public IPortableObject Item { get; set; } + } } } http://git-wip-us.apache.org/repos/asf/ignite/blob/9d67c20c/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/ResourceTaskTest.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/ResourceTaskTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/ResourceTaskTest.cs index 55bb9d0..da72c7b 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/ResourceTaskTest.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/ResourceTaskTest.cs @@ -100,7 +100,7 @@ namespace Apache.Ignite.Core.Tests.Compute } /** <inheritDoc /> */ - public ComputeJobResultPolicy Result(IComputeJobResult<int> res, IList<IComputeJobResult<int>> rcvd) + public ComputeJobResultPolicy OnResult(IComputeJobResult<int> res, IList<IComputeJobResult<int>> rcvd) { return ComputeJobResultPolicy.Wait; } @@ -108,7 +108,7 @@ namespace Apache.Ignite.Core.Tests.Compute /** <inheritDoc /> */ public int Reduce(IList<IComputeJobResult<int>> results) { - return results.Sum(res => res.Data()); + return results.Sum(res => res.Data); } } @@ -509,12 +509,12 @@ namespace Apache.Ignite.Core.Tests.Compute } /** <inheritDoc /> */ - public ComputeJobResultPolicy Result(IComputeJobResult<int> res, IList<IComputeJobResult<int>> rcvd) + public ComputeJobResultPolicy OnResult(IComputeJobResult<int> res, IList<IComputeJobResult<int>> rcvd) { Assert.IsTrue(rcvd != null); Assert.IsTrue(rcvd.Count == 0); - _sum += res.Data(); + _sum += res.Data; return ComputeJobResultPolicy.Wait; } http://git-wip-us.apache.org/repos/asf/ignite/blob/9d67c20c/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/TaskAdapterTest.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/TaskAdapterTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/TaskAdapterTest.cs index 7c4d52e..9b58268 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/TaskAdapterTest.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/TaskAdapterTest.cs @@ -132,7 +132,7 @@ namespace Apache.Ignite.Core.Tests.Compute HashSet<Guid> nodes = new HashSet<Guid>(); foreach (var res in results) { - Guid id = res.Data(); + Guid id = res.Data; Assert.NotNull(id); @@ -168,7 +168,7 @@ namespace Apache.Ignite.Core.Tests.Compute { Assert.AreEqual(1, results.Count); - Assert.IsTrue(results[0].Data()); + Assert.IsTrue(results[0].Data); return true; } http://git-wip-us.apache.org/repos/asf/ignite/blob/9d67c20c/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/TaskResultTest.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/TaskResultTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/TaskResultTest.cs index 0073d47..7108f59 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/TaskResultTest.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/TaskResultTest.cs @@ -332,7 +332,7 @@ namespace Apache.Ignite.Core.Tests.Compute var res = results[0]; - Assert.IsNull(res.Exception()); + Assert.IsNull(res.Exception); Assert.IsFalse(res.Cancelled); @@ -340,11 +340,11 @@ namespace Apache.Ignite.Core.Tests.Compute Assert.AreEqual(GridId(_gridName), res.NodeId); - var job = res.Job(); + var job = res.Job; Assert.IsNotNull(job); - return res.Data(); + return res.Data; } } http://git-wip-us.apache.org/repos/asf/ignite/blob/9d67c20c/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Examples/PathUtil.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Examples/PathUtil.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Examples/PathUtil.cs index 9ac3530..a128b7d 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Examples/PathUtil.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Examples/PathUtil.cs @@ -18,7 +18,6 @@ namespace Apache.Ignite.Core.Tests.Examples { using System.IO; - using Apache.Ignite.Core.Impl; /// <summary> /// Grid path resolver. http://git-wip-us.apache.org/repos/asf/ignite/blob/9d67c20c/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteManagerTest.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteManagerTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteManagerTest.cs index 590f0e6..2b73da9 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteManagerTest.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteManagerTest.cs @@ -19,7 +19,6 @@ namespace Apache.Ignite.Core.Tests { using System; using System.IO; - using Apache.Ignite.Core.Impl; using Apache.Ignite.Core.Impl.Common; using NUnit.Framework; http://git-wip-us.apache.org/repos/asf/ignite/blob/9d67c20c/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Process/IgniteProcess.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Process/IgniteProcess.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Process/IgniteProcess.cs index 2d9fbeb..4853d93 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Process/IgniteProcess.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Process/IgniteProcess.cs @@ -23,7 +23,6 @@ namespace Apache.Ignite.Core.Tests.Process using System.Linq; using System.Text; using System.Threading; - using Apache.Ignite.Core.Impl; using Apache.Ignite.Core.Impl.Common; /// <summary> http://git-wip-us.apache.org/repos/asf/ignite/blob/9d67c20c/modules/platforms/dotnet/Apache.Ignite.Core.Tests/SerializationTest.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/SerializationTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/SerializationTest.cs index e1a543e..07caaf3 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/SerializationTest.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/SerializationTest.cs @@ -195,7 +195,7 @@ namespace Apache.Ignite.Core.Tests return subgrid.ToDictionary(x => (IComputeJob<string>) new ToStringJob {Arg = arg}, x => x); } - public ComputeJobResultPolicy Result(IComputeJobResult<string> res, IList<IComputeJobResult<string>> rcvd) + public ComputeJobResultPolicy OnResult(IComputeJobResult<string> res, IList<IComputeJobResult<string>> rcvd) { return ComputeJobResultPolicy.Wait; } @@ -204,7 +204,7 @@ namespace Apache.Ignite.Core.Tests { var result = new SerializableXmlDoc(); - result.LoadXml(CombineStrings(results.Select(x => x.Data()))); + result.LoadXml(CombineStrings(results.Select(x => x.Data))); return result; } http://git-wip-us.apache.org/repos/asf/ignite/blob/9d67c20c/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 be96fd9..f314c99 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj @@ -186,7 +186,6 @@ <Compile Include="Impl\Common\IFutureInternal.cs" /> <Compile Include="Impl\Common\IgniteHome.cs" /> <Compile Include="Impl\Common\LoadedAssembliesResolver.cs" /> - <Compile Include="Impl\Common\PortableResultWrapper.cs" /> <Compile Include="Impl\Common\TypeCaster.cs" /> <Compile Include="Impl\Compute\Closure\ComputeAbstractClosureTask.cs" /> <Compile Include="Impl\Compute\Closure\ComputeActionJob.cs" /> @@ -263,7 +262,6 @@ <Compile Include="Impl\Portable\PortableMarshaller.cs" /> <Compile Include="Impl\Portable\PortableMode.cs" /> <Compile Include="Impl\Portable\PortableObjectHandle.cs" /> - <Compile Include="Impl\Portable\PortableOrSerializableObjectHolder.cs" /> <Compile Include="Impl\Portable\PortableReaderExtensions.cs" /> <Compile Include="Impl\Portable\PortableReaderHandleDictionary.cs" /> <Compile Include="Impl\Portable\PortableReaderImpl.cs" /> http://git-wip-us.apache.org/repos/asf/ignite/blob/9d67c20c/modules/platforms/dotnet/Apache.Ignite.Core/Compute/ComputeJobAdapter.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Compute/ComputeJobAdapter.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Compute/ComputeJobAdapter.cs index a472b50..2a0ed4e 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Compute/ComputeJobAdapter.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Compute/ComputeJobAdapter.cs @@ -114,7 +114,7 @@ namespace Apache.Ignite.Core.Compute /// <returns> /// Job execution result (possibly <c>null</c>). This result will be returned /// in <see cref="IComputeJobResult{T}" /> object passed into - /// <see cref="IComputeTask{A,T,R}.Result" /> + /// <see cref="IComputeTask{TA,T,TR}.OnResult" /> /// on caller node. /// </returns> public abstract T Execute(); http://git-wip-us.apache.org/repos/asf/ignite/blob/9d67c20c/modules/platforms/dotnet/Apache.Ignite.Core/Compute/ComputeJobResultPolicy.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Compute/ComputeJobResultPolicy.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Compute/ComputeJobResultPolicy.cs index 6fa0808..9807c37 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Compute/ComputeJobResultPolicy.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Compute/ComputeJobResultPolicy.cs @@ -21,7 +21,7 @@ namespace Apache.Ignite.Core.Compute /// <summary> /// This enumeration provides different types of actions following the last received job result. See - /// <see cref="IComputeTask{A,T,R}.Result(IComputeJobResult{T}, IList{IComputeJobResult{T}})"/> + /// <see cref="IComputeTask{TA,T,TR}.OnResult"/> /// for more details. /// </summary> public enum ComputeJobResultPolicy http://git-wip-us.apache.org/repos/asf/ignite/blob/9d67c20c/modules/platforms/dotnet/Apache.Ignite.Core/Compute/ComputeTaskAdapter.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Compute/ComputeTaskAdapter.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Compute/ComputeTaskAdapter.cs index 5965d2b..367947a 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Compute/ComputeTaskAdapter.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Compute/ComputeTaskAdapter.cs @@ -42,10 +42,10 @@ namespace Apache.Ignite.Core.Compute /// <param name="res">Received remote Ignite executable result.</param> /// <param name="rcvd">All previously received results.</param> /// <returns>Result policy that dictates how to process further upcoming job results.</returns> - public virtual ComputeJobResultPolicy Result(IComputeJobResult<TJobRes> res, + public virtual ComputeJobResultPolicy OnResult(IComputeJobResult<TJobRes> res, IList<IComputeJobResult<TJobRes>> rcvd) { - Exception err = res.Exception(); + Exception err = res.Exception; if (err != null) { http://git-wip-us.apache.org/repos/asf/ignite/blob/9d67c20c/modules/platforms/dotnet/Apache.Ignite.Core/Compute/ComputeTaskNoResultCacheAttribute.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Compute/ComputeTaskNoResultCacheAttribute.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Compute/ComputeTaskNoResultCacheAttribute.cs index a58aa87..b8a884d 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Compute/ComputeTaskNoResultCacheAttribute.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Compute/ComputeTaskNoResultCacheAttribute.cs @@ -23,7 +23,7 @@ namespace Apache.Ignite.Core.Compute /// This attribute disables caching of task results when attached to <see cref="IComputeTask{A,T,R}"/> /// instance. Use it when number of jobs within task grows too big, or jobs themselves are too large /// to keep in memory throughout task execution. By default all results are cached and passed into - /// <see cref="IComputeTask{A,T,R}.Result"/> + /// <see cref="IComputeTask{TA,T,TR}.OnResult"/> /// and <see cref="IComputeTask{A,T,R}.Reduce"/> methods. When this /// attribute is attached to a task class, then this list of job results will always be empty. /// </summary> http://git-wip-us.apache.org/repos/asf/ignite/blob/9d67c20c/modules/platforms/dotnet/Apache.Ignite.Core/Compute/IComputeJob.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Compute/IComputeJob.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Compute/IComputeJob.cs index 684ff95..36f47d5 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Compute/IComputeJob.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Compute/IComputeJob.cs @@ -29,7 +29,7 @@ namespace Apache.Ignite.Core.Compute /// <para /> /// Once job execution is complete, the return value will be sent back to parent task and will /// be passed into - /// <see cref="IComputeTask{A,T,R}.Result(IComputeJobResult{T}, IList{IComputeJobResult{T}})"/> + /// <see cref="IComputeTask{TA,T,TR}.OnResult"/> /// method via <see cref="IComputeJobResult{T}"/> instance. /// <para /> /// Ignite job implementation can be injected with <see cref="IIgnite"/> using @@ -42,7 +42,7 @@ namespace Apache.Ignite.Core.Compute /// </summary> /// <returns>Job execution result (possibly <c>null</c>). This result will be returned /// in <see cref="IComputeJobResult{T}"/> object passed into - /// <see cref="IComputeTask{A,T,R}.Result(IComputeJobResult{T}, IList{IComputeJobResult{T}})"/> + /// <see cref="IComputeTask{TA,T,TR}.OnResult"/> /// on caller node.</returns> TRes Execute(); http://git-wip-us.apache.org/repos/asf/ignite/blob/9d67c20c/modules/platforms/dotnet/Apache.Ignite.Core/Compute/IComputeJobResult.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Compute/IComputeJobResult.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Compute/IComputeJobResult.cs index 6369eb5..e5c1c66 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Compute/IComputeJobResult.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Compute/IComputeJobResult.cs @@ -22,7 +22,7 @@ namespace Apache.Ignite.Core.Compute /// <summary> /// Job execution result which gets passed to - /// <see cref="IComputeTask{A,T,R}.Result(IComputeJobResult{T}, IList{IComputeJobResult{T}})"/> + /// <see cref="IComputeTask{TA,T,TR}.OnResult"/> /// method. /// </summary> public interface IComputeJobResult<out TRes> @@ -33,41 +33,34 @@ namespace Apache.Ignite.Core.Compute /// <para /> /// Note that if task is annotated with <see cref="ComputeTaskNoResultCacheAttribute"/> /// attribute, then job results will not be cached and will be available only in - /// <see cref="IComputeTask{A,T,R}.Result(IComputeJobResult{T}, IList{IComputeJobResult{T}})"/> + /// <see cref="IComputeTask{TA,T,TR}.OnResult"/> /// method for every individual job, but not in - /// <see cref="IComputeTask{A,T,R}.Reduce(IList{IComputeJobResult{T}})"/> method. - /// + /// <see cref="IComputeTask{A,T,R}.Reduce(IList{IComputeJobResult{T}})"/> method. /// </summary> /// <returns>Data returned by job.</returns> - TRes Data(); + TRes Data { get; } /// <summary> /// Gets local instance of remote job produced this result. /// </summary> /// <returns></returns> - IComputeJob<TRes> Job(); + IComputeJob<TRes> Job { get; } /// <summary> /// Gets exception produced by execution of remote job, or <c>null</c> if no /// exception was produced. /// </summary> - /// <returns>Exception or <c>null</c> in case of success.</returns> - Exception Exception(); + /// <value>Exception or <c>null</c> in case of success.</value> + Exception Exception { get; } /// <summary> /// ID of the node where actual job execution occurred. /// </summary> - Guid NodeId - { - get; - } + Guid NodeId { get; } /// <summary> /// Whether the job was cancelled. /// </summary> - bool Cancelled - { - get; - } + bool Cancelled { get; } } } http://git-wip-us.apache.org/repos/asf/ignite/blob/9d67c20c/modules/platforms/dotnet/Apache.Ignite.Core/Compute/IComputeTask.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Compute/IComputeTask.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Compute/IComputeTask.cs index d3d7ccf..7677653 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Compute/IComputeTask.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Compute/IComputeTask.cs @@ -105,7 +105,7 @@ namespace Apache.Ignite.Core.Compute /// <param name="rcvd">All previously received results. Note that if task class has /// <see cref="ComputeTaskNoResultCacheAttribute"/> attribute, then this list will be empty.</param> /// <returns>Result policy that dictates how to process further upcoming job results.</returns> - ComputeJobResultPolicy Result(IComputeJobResult<TJobRes> res, IList<IComputeJobResult<TJobRes>> rcvd); + ComputeJobResultPolicy OnResult(IComputeJobResult<TJobRes> res, IList<IComputeJobResult<TJobRes>> rcvd); /// <summary> /// Reduces (or aggregates) results received so far into one compound result to be returned to http://git-wip-us.apache.org/repos/asf/ignite/blob/9d67c20c/modules/platforms/dotnet/Apache.Ignite.Core/Datastream/StreamTransformer.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Datastream/StreamTransformer.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Datastream/StreamTransformer.cs index d8b4620..cd3e5f6 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Datastream/StreamTransformer.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Datastream/StreamTransformer.cs @@ -67,7 +67,7 @@ namespace Apache.Ignite.Core.Datastream w.WriteByte(StreamReceiverHolder.RcvTransformer); - PortableUtils.WritePortableOrSerializable(w, _proc); + w.WriteObject(_proc); } } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/9d67c20c/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheEntryFilterHolder.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheEntryFilterHolder.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheEntryFilterHolder.cs index 279979a..c01103e 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheEntryFilterHolder.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheEntryFilterHolder.cs @@ -92,7 +92,7 @@ namespace Apache.Ignite.Core.Impl.Cache { var writer0 = (PortableWriterImpl)writer.GetRawWriter(); - writer0.WithDetach(w => PortableUtils.WritePortableOrSerializable(w, _pred)); + writer0.WithDetach(w => w.WriteObject(_pred)); writer0.WriteBoolean(_keepPortable); } @@ -105,7 +105,7 @@ namespace Apache.Ignite.Core.Impl.Cache { var reader0 = (PortableReaderImpl)reader.GetRawReader(); - _pred = PortableUtils.ReadPortableOrSerializable<object>(reader0); + _pred = reader0.ReadObject<object>(); _keepPortable = reader0.ReadBoolean(); http://git-wip-us.apache.org/repos/asf/ignite/blob/9d67c20c/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheEntryProcessorHolder.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheEntryProcessorHolder.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheEntryProcessorHolder.cs index 8b30536..3f21b53 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheEntryProcessorHolder.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheEntryProcessorHolder.cs @@ -105,8 +105,8 @@ namespace Apache.Ignite.Core.Impl.Cache { var writer0 = (PortableWriterImpl) writer.GetRawWriter(); - writer0.WithDetach(w => PortableUtils.WritePortableOrSerializable(w, _proc)); - writer0.WithDetach(w => PortableUtils.WritePortableOrSerializable(w, _arg)); + writer0.WithDetach(w => w.WriteObject(_proc)); + writer0.WithDetach(w => w.WriteObject(_arg)); } /// <summary> @@ -117,8 +117,8 @@ namespace Apache.Ignite.Core.Impl.Cache { var reader0 = (PortableReaderImpl) reader.GetRawReader(); - _proc = PortableUtils.ReadPortableOrSerializable<object>(reader0); - _arg = PortableUtils.ReadPortableOrSerializable<object>(reader0); + _proc = reader0.ReadObject<object>(); + _arg = reader0.ReadObject<object>(); _processFunc = GetProcessFunc(_proc); http://git-wip-us.apache.org/repos/asf/ignite/blob/9d67c20c/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheEntryProcessorResultHolder.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheEntryProcessorResultHolder.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheEntryProcessorResultHolder.cs index 02928e9..a6641e1 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheEntryProcessorResultHolder.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheEntryProcessorResultHolder.cs @@ -21,7 +21,6 @@ namespace Apache.Ignite.Core.Impl.Cache using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.IO; - using Apache.Ignite.Core.Impl.Common; using Apache.Ignite.Core.Impl.Portable; using Apache.Ignite.Core.Impl.Portable.IO; @@ -101,7 +100,7 @@ namespace Apache.Ignite.Core.Impl.Cache else { writer.WriteByte((byte) MutableCacheEntryState.ErrPortable); - writer.Write(new PortableResultWrapper(Error)); + writer.Write(Error); } } catch (Exception marshErr) http://git-wip-us.apache.org/repos/asf/ignite/blob/9d67c20c/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheImpl.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheImpl.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheImpl.cs index c689bb4..af230b3 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheImpl.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheImpl.cs @@ -885,15 +885,10 @@ namespace Apache.Ignite.Core.Impl.Cache /// <returns>Result.</returns> private static T GetResultOrThrow<T>(object obj) { - var holder = obj as PortableResultWrapper; + var err = obj as Exception; - if (holder != null) - { - var err = holder.Result as Exception; - - if (err != null) - throw err as CacheEntryProcessorException ?? new CacheEntryProcessorException(err); - } + if (err != null) + throw err as CacheEntryProcessorException ?? new CacheEntryProcessorException(err); return obj == null ? default(T) : (T) obj; } @@ -939,7 +934,7 @@ namespace Apache.Ignite.Core.Impl.Cache var clsName = item as string; if (clsName == null) - return new CacheEntryProcessorException((Exception) ((PortableResultWrapper) item).Result); + return new CacheEntryProcessorException((Exception) item); var msg = Unmarshal<string>(inStream); http://git-wip-us.apache.org/repos/asf/ignite/blob/9d67c20c/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Query/Continuous/ContinuousQueryFilterHolder.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Query/Continuous/ContinuousQueryFilterHolder.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Query/Continuous/ContinuousQueryFilterHolder.cs index 5737ed3..a7cb245 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Query/Continuous/ContinuousQueryFilterHolder.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Query/Continuous/ContinuousQueryFilterHolder.cs @@ -65,10 +65,9 @@ namespace Apache.Ignite.Core.Impl.Cache.Query.Continuous /// <param name="writer">Writer.</param> public void WritePortable(IPortableWriter writer) { - PortableWriterImpl rawWriter = (PortableWriterImpl) writer.GetRawWriter(); - - PortableUtils.WritePortableOrSerializable(rawWriter, _filter); + var rawWriter = (PortableWriterImpl) writer.GetRawWriter(); + rawWriter.WriteObject(_filter); rawWriter.WriteBoolean(_keepPortable); } @@ -80,7 +79,7 @@ namespace Apache.Ignite.Core.Impl.Cache.Query.Continuous { var rawReader = (PortableReaderImpl) reader.GetRawReader(); - _filter = PortableUtils.ReadPortableOrSerializable<object>(rawReader); + _filter = rawReader.ReadObject<object>(); _keepPortable = rawReader.ReadBoolean(); } } http://git-wip-us.apache.org/repos/asf/ignite/blob/9d67c20c/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/PortableResultWrapper.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/PortableResultWrapper.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/PortableResultWrapper.cs deleted file mode 100644 index c9fddf3..0000000 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/PortableResultWrapper.cs +++ /dev/null @@ -1,67 +0,0 @@ -/* - * 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 Apache.Ignite.Core.Impl.Portable; - using Apache.Ignite.Core.Portable; - - /// <summary> - /// Simple wrapper over result to handle marshalling properly. - /// </summary> - internal class PortableResultWrapper : IPortableWriteAware - { - /** */ - private readonly object _result; - - /// <summary> - /// Initializes a new instance of the <see cref="PortableResultWrapper"/> class. - /// </summary> - /// <param name="reader">The reader.</param> - public PortableResultWrapper(IPortableReader reader) - { - var reader0 = (PortableReaderImpl)reader.GetRawReader(); - - _result = PortableUtils.ReadPortableOrSerializable<object>(reader0); - } - - /// <summary> - /// Constructor. - /// </summary> - /// <param name="res">Result.</param> - public PortableResultWrapper(object res) - { - _result = res; - } - - /// <summary> - /// Result. - /// </summary> - public object Result - { - get { return _result; } - } - - /** <inheritDoc /> */ - public void WritePortable(IPortableWriter writer) - { - var writer0 = (PortableWriterImpl) writer.GetRawWriter(); - - writer0.WithDetach(w => PortableUtils.WritePortableOrSerializable(w, Result)); - } - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/9d67c20c/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/Closure/ComputeAbstractClosureTask.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/Closure/ComputeAbstractClosureTask.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/Closure/ComputeAbstractClosureTask.cs index 1a772c2..286ae3a 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/Closure/ComputeAbstractClosureTask.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/Closure/ComputeAbstractClosureTask.cs @@ -60,9 +60,9 @@ namespace Apache.Ignite.Core.Impl.Compute.Closure /// <returns> /// Result policy that dictates how to process further upcoming job results. /// </returns> - public ComputeJobResultPolicy Result(IComputeJobResult<T> res, IList<IComputeJobResult<T>> rcvd) + public ComputeJobResultPolicy OnResult(IComputeJobResult<T> res, IList<IComputeJobResult<T>> rcvd) { - Exception err = res.Exception(); + Exception err = res.Exception; if (err != null) { http://git-wip-us.apache.org/repos/asf/ignite/blob/9d67c20c/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/Closure/ComputeActionJob.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/Closure/ComputeActionJob.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/Closure/ComputeActionJob.cs index cc5e29f..24f78b3 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/Closure/ComputeActionJob.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/Closure/ComputeActionJob.cs @@ -65,7 +65,7 @@ namespace Apache.Ignite.Core.Impl.Compute.Closure { var writer0 = (PortableWriterImpl)writer.GetRawWriter(); - writer0.WithDetach(w => PortableUtils.WritePortableOrSerializable(w, _action)); + writer0.WithDetach(w => w.WriteObject(_action)); } /// <summary> @@ -76,7 +76,7 @@ namespace Apache.Ignite.Core.Impl.Compute.Closure { var reader0 = (PortableReaderImpl)reader.GetRawReader(); - _action = PortableUtils.ReadPortableOrSerializable<IComputeAction>(reader0); + _action = reader0.ReadObject<IComputeAction>(); } } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/9d67c20c/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/Closure/ComputeFuncJob.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/Closure/ComputeFuncJob.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/Closure/ComputeFuncJob.cs index 072fe76..5dcd3e8 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/Closure/ComputeFuncJob.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/Closure/ComputeFuncJob.cs @@ -67,8 +67,8 @@ namespace Apache.Ignite.Core.Impl.Compute.Closure { PortableWriterImpl writer0 = (PortableWriterImpl) writer.GetRawWriter(); - writer0.WithDetach(w => PortableUtils.WritePortableOrSerializable(w, _clo)); - writer0.WithDetach(w => PortableUtils.WritePortableOrSerializable(w, _arg)); + writer0.WithDetach(w => w.WriteObject(_clo)); + writer0.WithDetach(w => w.WriteObject(_arg)); } /// <summary> @@ -78,9 +78,9 @@ namespace Apache.Ignite.Core.Impl.Compute.Closure public ComputeFuncJob(IPortableReader reader) { var reader0 = (PortableReaderImpl) reader.GetRawReader(); - - _clo = PortableUtils.ReadPortableOrSerializable<IComputeFunc>(reader0); - _arg = PortableUtils.ReadPortableOrSerializable<object>(reader0); + + _clo = reader0.ReadObject<IComputeFunc>(); + _arg = reader0.ReadObject<object>(); } } } http://git-wip-us.apache.org/repos/asf/ignite/blob/9d67c20c/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/Closure/ComputeMultiClosureTask.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/Closure/ComputeMultiClosureTask.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/Closure/ComputeMultiClosureTask.cs index dd57f6c..f26fe93 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/Closure/ComputeMultiClosureTask.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/Closure/ComputeMultiClosureTask.cs @@ -42,7 +42,7 @@ namespace Apache.Ignite.Core.Impl.Compute.Closure /** <inheritDoc /> */ protected override ComputeJobResultPolicy Result0(IComputeJobResult<T> res) { - _res.Add(res.Data()); + _res.Add(res.Data); return ComputeJobResultPolicy.Wait; } http://git-wip-us.apache.org/repos/asf/ignite/blob/9d67c20c/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/Closure/ComputeOutFuncJob.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/Closure/ComputeOutFuncJob.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/Closure/ComputeOutFuncJob.cs index 11ec157..1b671fd 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/Closure/ComputeOutFuncJob.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/Closure/ComputeOutFuncJob.cs @@ -62,14 +62,14 @@ namespace Apache.Ignite.Core.Impl.Compute.Closure { var writer0 = (PortableWriterImpl) writer.GetRawWriter(); - writer0.WithDetach(w => PortableUtils.WritePortableOrSerializable(w, _clo)); + writer0.WithDetach(w => w.WriteObject(_clo)); } public ComputeOutFuncJob(IPortableReader reader) { var reader0 = (PortableReaderImpl) reader.GetRawReader(); - _clo = PortableUtils.ReadPortableOrSerializable<IComputeOutFunc>(reader0); + _clo = reader0.ReadObject<IComputeOutFunc>(); } } } http://git-wip-us.apache.org/repos/asf/ignite/blob/9d67c20c/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/Closure/ComputeReducingClosureTask.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/Closure/ComputeReducingClosureTask.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/Closure/ComputeReducingClosureTask.cs index a84d7ce..8e2260e 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/Closure/ComputeReducingClosureTask.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/Closure/ComputeReducingClosureTask.cs @@ -43,7 +43,7 @@ namespace Apache.Ignite.Core.Impl.Compute.Closure /** <inheritDoc /> */ protected override ComputeJobResultPolicy Result0(IComputeJobResult<T> res) { - return _rdc.Collect(res.Data()) ? ComputeJobResultPolicy.Wait : ComputeJobResultPolicy.Reduce; + return _rdc.Collect(res.Data) ? ComputeJobResultPolicy.Wait : ComputeJobResultPolicy.Reduce; } /** <inheritDoc /> */ http://git-wip-us.apache.org/repos/asf/ignite/blob/9d67c20c/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/Closure/ComputeSingleClosureTask.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/Closure/ComputeSingleClosureTask.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/Closure/ComputeSingleClosureTask.cs index 6e82c9b..20da4b6 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/Closure/ComputeSingleClosureTask.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/Closure/ComputeSingleClosureTask.cs @@ -32,7 +32,7 @@ namespace Apache.Ignite.Core.Impl.Compute.Closure /** <inheritDoc /> */ protected override ComputeJobResultPolicy Result0(IComputeJobResult<T> res) { - _res = (TR) res.Data(); + _res = (TR) res.Data; // No more results are expected at this point, but we prefer not to alter regular // task flow. http://git-wip-us.apache.org/repos/asf/ignite/blob/9d67c20c/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeFunc.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeFunc.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeFunc.cs index 4195120..f21d3da 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeFunc.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeFunc.cs @@ -75,7 +75,7 @@ namespace Apache.Ignite.Core.Impl.Compute { var writer0 = (PortableWriterImpl)writer.GetRawWriter(); - writer0.WithDetach(w => PortableUtils.WritePortableOrSerializable(w, _func)); + writer0.WithDetach(w => w.WriteObject(_func)); } /// <summary> @@ -86,7 +86,7 @@ namespace Apache.Ignite.Core.Impl.Compute { var reader0 = (PortableReaderImpl)reader.GetRawReader(); - _func = PortableUtils.ReadPortableOrSerializable<object>(reader0); + _func = reader0.ReadObject<object>(); _invoker = DelegateTypeDescriptor.GetComputeFunc(_func.GetType()); } http://git-wip-us.apache.org/repos/asf/ignite/blob/9d67c20c/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeJob.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeJob.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeJob.cs index 61cc4d8..eb8fee5 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeJob.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeJob.cs @@ -56,7 +56,7 @@ namespace Apache.Ignite.Core.Impl.Compute { var reader0 = (PortableReaderImpl)reader.GetRawReader(); - _job = PortableUtils.ReadPortableOrSerializable<object>(reader0); + _job = reader0.ReadObject<object>(); DelegateTypeDescriptor.GetComputeJob(_job.GetType(), out _execute, out _cancel); } @@ -104,7 +104,7 @@ namespace Apache.Ignite.Core.Impl.Compute { var writer0 = (PortableWriterImpl)writer.GetRawWriter(); - writer0.WithDetach(w => PortableUtils.WritePortableOrSerializable(w, Job)); + writer0.WithDetach(w => w.WriteObject(Job)); } /// <summary> http://git-wip-us.apache.org/repos/asf/ignite/blob/9d67c20c/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeJobHolder.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeJobHolder.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeJobHolder.cs index ab41100..178937c 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeJobHolder.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeJobHolder.cs @@ -55,7 +55,7 @@ namespace Apache.Ignite.Core.Impl.Compute _ignite = reader0.Marshaller.Ignite; - _job = PortableUtils.ReadPortableOrSerializable<IComputeJob>(reader0); + _job = reader0.ReadObject<IComputeJob>(); } /// <summary> @@ -113,7 +113,7 @@ namespace Apache.Ignite.Core.Impl.Compute try { // 3. Marshal results. - PortableUtils.WriteWrappedInvocationResult(writer, success, res); + PortableUtils.WriteInvocationResult(writer, success, res); } finally { @@ -220,7 +220,7 @@ namespace Apache.Ignite.Core.Impl.Compute { PortableWriterImpl writer0 = (PortableWriterImpl) writer.GetRawWriter(); - writer0.WithDetach(w => PortableUtils.WritePortableOrSerializable(w, _job)); + writer0.WithDetach(w => w.WriteObject(_job)); } /// <summary> http://git-wip-us.apache.org/repos/asf/ignite/blob/9d67c20c/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeJobResultGenericWrapper.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeJobResultGenericWrapper.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeJobResultGenericWrapper.cs index 8173f71..5654d96 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeJobResultGenericWrapper.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeJobResultGenericWrapper.cs @@ -38,21 +38,24 @@ namespace Apache.Ignite.Core.Impl.Compute } /** <inheritdoc /> */ - public T Data() + + public T Data { - return (T)_wrappedRes.Data(); + get { return (T) _wrappedRes.Data; } } /** <inheritdoc /> */ - public Exception Exception() + + public Exception Exception { - return _wrappedRes.Exception(); + get { return _wrappedRes.Exception; } } /** <inheritdoc /> */ - public IComputeJob<T> Job() + + public IComputeJob<T> Job { - return _wrappedRes.Job().Unwrap<object, T>(); + get { return _wrappedRes.Job.Unwrap<object, T>(); } } /** <inheritdoc /> */ http://git-wip-us.apache.org/repos/asf/ignite/blob/9d67c20c/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeJobResultImpl.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeJobResultImpl.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeJobResultImpl.cs index a35bae0..fe5aedd 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeJobResultImpl.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeJobResultImpl.cs @@ -58,21 +58,24 @@ namespace Apache.Ignite.Core.Impl.Compute } /** <inheritDoc /> */ - public object Data() + + public object Data { - return _data; + get { return _data; } } /** <inheritDoc /> */ - public Exception Exception() + + public Exception Exception { - return _err; + get { return _err; } } /** <inheritDoc /> */ - public IComputeJob<object> Job() + + public IComputeJob<object> Job { - return _job; + get { return _job; } } /** <inheritDoc /> */ http://git-wip-us.apache.org/repos/asf/ignite/blob/9d67c20c/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeOutFunc.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeOutFunc.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeOutFunc.cs index 3b7e2b5..3746bbe 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeOutFunc.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeOutFunc.cs @@ -79,7 +79,7 @@ namespace Apache.Ignite.Core.Impl.Compute { var writer0 = (PortableWriterImpl)writer.GetRawWriter(); - writer0.WithDetach(w => PortableUtils.WritePortableOrSerializable(w, _func)); + writer0.WithDetach(w => w.WriteObject(_func)); } /// <summary> @@ -90,7 +90,7 @@ namespace Apache.Ignite.Core.Impl.Compute { var reader0 = (PortableReaderImpl)reader.GetRawReader(); - _func = PortableUtils.ReadPortableOrSerializable<object>(reader0); + _func = reader0.ReadObject<object>(); _invoker = DelegateTypeDescriptor.GetComputeOutFunc(_func.GetType()); } http://git-wip-us.apache.org/repos/asf/ignite/blob/9d67c20c/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeTaskHolder.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeTaskHolder.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeTaskHolder.cs index 552e0eb..ef27889 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeTaskHolder.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeTaskHolder.cs @@ -299,7 +299,7 @@ namespace Apache.Ignite.Core.Impl.Compute { object err; - var data = PortableUtils.ReadWrappedInvocationResult(reader, out err); + var data = PortableUtils.ReadInvocationResult(reader, out err); // 2. Process the result. return (int) JobResult0(new ComputeJobResultImpl(data, (Exception) err, job.Job, nodeId.Value, cancelled)); @@ -364,15 +364,9 @@ namespace Apache.Ignite.Core.Impl.Compute try { - if (reader.ReadBoolean()) - { - PortableResultWrapper res = reader.ReadObject<PortableUserObject>() - .Deserialize<PortableResultWrapper>(); - - err = (Exception) res.Result; - } - else - err = ExceptionUtils.GetException(reader.ReadString(), reader.ReadString()); + err = reader.ReadBoolean() + ? reader.ReadObject<PortableUserObject>().Deserialize<Exception>() + : ExceptionUtils.GetException(reader.ReadString(), reader.ReadString()); } catch (Exception e) { @@ -425,17 +419,17 @@ namespace Apache.Ignite.Core.Impl.Compute ress0 = EmptyRes; // 2. Invoke user code. - var policy = _task.Result(new ComputeJobResultGenericWrapper<T>(res), ress0); + var policy = _task.OnResult(new ComputeJobResultGenericWrapper<T>(res), ress0); // 3. Add result to the list only in case of success. if (_resCache) { - var job = res.Job().Unwrap(); + var job = res.Job.Unwrap(); if (!_resJobs.Add(job)) { // Duplicate result => find and replace it with the new one. - var oldRes = _ress.Single(item => item.Job() == job); + var oldRes = _ress.Single(item => item.Job == job); _ress.Remove(oldRes); } http://git-wip-us.apache.org/repos/asf/ignite/blob/9d67c20c/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Datastream/StreamReceiverHolder.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Datastream/StreamReceiverHolder.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Datastream/StreamReceiverHolder.cs index 32cbc0b..4c72a90 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Datastream/StreamReceiverHolder.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Datastream/StreamReceiverHolder.cs @@ -54,8 +54,8 @@ namespace Apache.Ignite.Core.Impl.Datastream { var rcvType = reader.ReadByte(); - _rcv = PortableUtils.ReadPortableOrSerializable<object>(reader); - + _rcv = reader.ReadObject<object>(); + Debug.Assert(_rcv != null); var type = _rcv.GetType(); @@ -98,7 +98,7 @@ namespace Apache.Ignite.Core.Impl.Datastream else { w.WriteByte(RcvNormal); - PortableUtils.WritePortableOrSerializable((PortableWriterImpl) writer, _rcv); + w.WriteObject(_rcv); } } http://git-wip-us.apache.org/repos/asf/ignite/blob/9d67c20c/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 6898a58..99ee2cd 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Events/Events.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Events/Events.cs @@ -113,7 +113,7 @@ namespace Apache.Ignite.Core.Impl.Events return DoOutInOp((int) Op.RemoteQuery, writer => { - writer.Write(new PortableOrSerializableObjectHolder(filter)); + writer.Write(filter); writer.WriteLong((long) (timeout == null ? 0 : timeout.Value.TotalMilliseconds)); @@ -155,7 +155,7 @@ namespace Apache.Ignite.Core.Impl.Events writer.WriteBoolean(remoteFilter != null); if (remoteFilter != null) - writer.Write(new PortableOrSerializableObjectHolder(remoteFilter)); + writer.Write(remoteFilter); WriteEventTypes(types, writer); }, http://git-wip-us.apache.org/repos/asf/ignite/blob/9d67c20c/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Events/RemoteListenEventFilter.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Events/RemoteListenEventFilter.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Events/RemoteListenEventFilter.cs index f8e2f95..cd04c66 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Events/RemoteListenEventFilter.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Events/RemoteListenEventFilter.cs @@ -21,7 +21,6 @@ namespace Apache.Ignite.Core.Impl.Events using System.Diagnostics; using Apache.Ignite.Core.Events; using Apache.Ignite.Core.Impl.Common; - using Apache.Ignite.Core.Impl.Portable; using Apache.Ignite.Core.Impl.Portable.IO; /// <summary> @@ -74,7 +73,7 @@ namespace Apache.Ignite.Core.Impl.Events var reader = marsh.StartUnmarshal(stream); - var pred = reader.ReadObject<PortableOrSerializableObjectHolder>().Item; + var pred = reader.ReadObject<object>(); var func = DelegateTypeDescriptor.GetEventFilter(pred.GetType()); http://git-wip-us.apache.org/repos/asf/ignite/blob/9d67c20c/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Messaging/MessageListenerHolder.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Messaging/MessageListenerHolder.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Messaging/MessageListenerHolder.cs index 412a84e..dc6585c 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Messaging/MessageListenerHolder.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Messaging/MessageListenerHolder.cs @@ -154,7 +154,7 @@ namespace Apache.Ignite.Core.Impl.Messaging { var writer0 = (PortableWriterImpl)writer.GetRawWriter(); - writer0.WithDetach(w => PortableUtils.WritePortableOrSerializable(w, Filter)); + writer0.WithDetach(w => w.WriteObject(Filter)); } /// <summary> @@ -165,7 +165,7 @@ namespace Apache.Ignite.Core.Impl.Messaging { var reader0 = (PortableReaderImpl)reader.GetRawReader(); - _filter = PortableUtils.ReadPortableOrSerializable<object>(reader0); + _filter = reader0.ReadObject<object>(); _invoker = GetInvoker(_filter); http://git-wip-us.apache.org/repos/asf/ignite/blob/9d67c20c/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/PortableMarshaller.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/PortableMarshaller.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/PortableMarshaller.cs index 6499946..2848df1 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/PortableMarshaller.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/PortableMarshaller.cs @@ -23,7 +23,6 @@ namespace Apache.Ignite.Core.Impl.Portable using System.Linq; using Apache.Ignite.Core.Impl.Cache; using Apache.Ignite.Core.Impl.Cache.Query.Continuous; - using Apache.Ignite.Core.Impl.Common; using Apache.Ignite.Core.Impl.Compute; using Apache.Ignite.Core.Impl.Compute.Closure; using Apache.Ignite.Core.Impl.Datastream; @@ -505,7 +504,6 @@ namespace Apache.Ignite.Core.Impl.Portable { AddSystemType(PortableUtils.TypeNativeJobHolder, w => new ComputeJobHolder(w)); AddSystemType(PortableUtils.TypeComputeJobWrapper, w => new ComputeJobWrapper(w)); - AddSystemType(PortableUtils.TypePortableJobResHolder, w => new PortableResultWrapper(w)); AddSystemType(PortableUtils.TypeIgniteProxy, w => new IgniteProxy()); AddSystemType(PortableUtils.TypeComputeOutFuncJob, w => new ComputeOutFuncJob(w)); AddSystemType(PortableUtils.TypeComputeOutFuncWrapper, w => new ComputeOutFuncWrapper(w)); @@ -517,7 +515,6 @@ namespace Apache.Ignite.Core.Impl.Portable AddSystemType(PortableUtils.TypeCacheEntryProcessorHolder, w => new CacheEntryProcessorHolder(w)); AddSystemType(PortableUtils.TypeCacheEntryPredicateHolder, w => new CacheEntryFilterHolder(w)); AddSystemType(PortableUtils.TypeMessageListenerHolder, w => new MessageListenerHolder(w)); - AddSystemType(PortableUtils.TypePortableOrSerializableHolder, w => new PortableOrSerializableObjectHolder(w)); AddSystemType(PortableUtils.TypeStreamReceiverHolder, w => new StreamReceiverHolder(w)); } http://git-wip-us.apache.org/repos/asf/ignite/blob/9d67c20c/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/PortableOrSerializableObjectHolder.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/PortableOrSerializableObjectHolder.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/PortableOrSerializableObjectHolder.cs deleted file mode 100644 index d2a2928..0000000 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/PortableOrSerializableObjectHolder.cs +++ /dev/null @@ -1,64 +0,0 @@ -/* - * 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.Portable -{ - using Apache.Ignite.Core.Portable; - - /// <summary> - /// Wraps portable/serializable item in a portable. - /// </summary> - internal class PortableOrSerializableObjectHolder : IPortableWriteAware - { - /** */ - private readonly object _item; - - /// <summary> - /// Initializes a new instance of the <see cref="SerializableObjectHolder"/> class. - /// </summary> - /// <param name="item">The item to wrap.</param> - public PortableOrSerializableObjectHolder(object item) - { - _item = item; - } - - /// <summary> - /// Gets or sets the item to wrap. - /// </summary> - public object Item - { - get { return _item; } - } - - /** <inheritDoc /> */ - public void WritePortable(IPortableWriter writer) - { - var writer0 = (PortableWriterImpl)writer.GetRawWriter(); - - writer0.WithDetach(w => PortableUtils.WritePortableOrSerializable(w, Item)); - } - - /// <summary> - /// Initializes a new instance of the <see cref="PortableOrSerializableObjectHolder"/> class. - /// </summary> - /// <param name="reader">The reader.</param> - public PortableOrSerializableObjectHolder(IPortableReader reader) - { - _item = PortableUtils.ReadPortableOrSerializable<object>((PortableReaderImpl)reader.GetRawReader()); - } - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/9d67c20c/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/PortableUtils.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/PortableUtils.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/PortableUtils.cs index e9ef369..dd72a8c 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/PortableUtils.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/PortableUtils.cs @@ -29,6 +29,7 @@ namespace Apache.Ignite.Core.Impl.Portable using System.Runtime.Serialization.Formatters.Binary; using System.Security.Policy; using System.Text; + using Apache.Ignite.Core.Impl.Common; using Apache.Ignite.Core.Impl.Portable.IO; using Apache.Ignite.Core.Portable; @@ -167,9 +168,6 @@ namespace Apache.Ignite.Core.Impl.Portable /** Type: native job holder. */ public const byte TypeNativeJobHolder = 77; - /** Type: native job result holder. */ - public const byte TypePortableJobResHolder = 76; - /** Type: Ignite proxy. */ public const byte TypeIgniteProxy = 74; @@ -1672,102 +1670,6 @@ namespace Apache.Ignite.Core.Impl.Portable } /// <summary> - /// Write object which is not necessary portable. - /// </summary> - /// <param name="writer">Writer.</param> - /// <param name="obj">Object.</param> - public static void WritePortableOrSerializable<T>(PortableWriterImpl writer, T obj) - { - if (writer.IsPortable(obj)) - { - writer.WriteBoolean(true); - - writer.WriteObject(obj); - } - else - { - writer.WriteBoolean(false); - - WriteSerializable(writer, obj); - } - } - - /// <summary> - /// Writes a serializable object. - /// </summary> - /// <param name="writer">Writer.</param> - /// <param name="obj">Object.</param> - public static void WriteSerializable<T>(PortableWriterImpl writer, T obj) - { - new BinaryFormatter().Serialize(new PortableStreamAdapter(writer.Stream), obj); - } - - /// <summary> - /// Read object which is not necessary portable. - /// </summary> - /// <param name="reader">Reader.</param> - /// <returns>Object.</returns> - public static T ReadPortableOrSerializable<T>(PortableReaderImpl reader) - { - return reader.ReadBoolean() - ? reader.ReadObject<T>() - : ReadSerializable<T>(reader); - } - - /// <summary> - /// Reads a serializable object. - /// </summary> - /// <param name="reader">Reader.</param> - /// <returns>Object.</returns> - public static T ReadSerializable<T>(PortableReaderImpl reader) - { - return (T) new BinaryFormatter().Deserialize(new PortableStreamAdapter(reader.Stream), null); - } - - /// <summary> - /// Writes wrapped invocation result. - /// </summary> - /// <param name="writer">Writer.</param> - /// <param name="success">Success flag.</param> - /// <param name="res">Result.</param> - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes")] - public static void WriteWrappedInvocationResult(PortableWriterImpl writer, bool success, object res) - { - var pos = writer.Stream.Position; - - try - { - if (success) - writer.WriteBoolean(true); - else - { - writer.WriteBoolean(false); // Call failed. - writer.WriteBoolean(true); // Exception serialized sucessfully. - } - - writer.Write(new PortableResultWrapper(res)); - } - catch (Exception marshErr) - { - // Failed to serialize result, fallback to plain string. - writer.Stream.Seek(pos, SeekOrigin.Begin); - - writer.WriteBoolean(false); // Call failed. - writer.WriteBoolean(false); // Cannot serialize result or exception. - - if (success) - { - writer.WriteString("Call completed successfully, but result serialization failed [resultType=" + - res.GetType().Name + ", serializationErrMsg=" + marshErr.Message + ']'); - } - else - { - writer.WriteString("Call completed with error, but error serialization failed [errType=" + - res.GetType().Name + ", serializationErrMsg=" + marshErr.Message + ']'); - } - } - } - /// <summary> /// Writes invocation result. /// </summary> /// <param name="writer">Writer.</param> @@ -1812,27 +1714,6 @@ namespace Apache.Ignite.Core.Impl.Portable } /// <summary> - /// Reads wrapped invocation result. - /// </summary> - /// <param name="reader">Reader.</param> - /// <param name="err">Error.</param> - /// <returns>Result.</returns> - public static object ReadWrappedInvocationResult(PortableReaderImpl reader, out object err) - { - err = null; - - if (reader.ReadBoolean()) - return reader.ReadObject<PortableResultWrapper>().Result; - - if (reader.ReadBoolean()) - err = (Exception) reader.ReadObject<PortableResultWrapper>().Result; - else - err = ExceptionUtils.GetException(reader.ReadString(), reader.ReadString()); - - return null; - } - - /// <summary> /// Reads invocation result. /// </summary> /// <param name="reader">Reader.</param> @@ -1845,10 +1726,9 @@ namespace Apache.Ignite.Core.Impl.Portable if (reader.ReadBoolean()) return reader.ReadObject<object>(); - if (reader.ReadBoolean()) - err = reader.ReadObject<object>(); - else - err = ExceptionUtils.GetException(reader.ReadString(), reader.ReadString()); + err = reader.ReadBoolean() + ? reader.ReadObject<object>() + : ExceptionUtils.GetException(reader.ReadString(), reader.ReadString()); return null; }
