IGNITE-5924 .NET: Decouple Marshaller from Ignite This closes #2559
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/8629b50d Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/8629b50d Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/8629b50d Branch: refs/heads/ignite-3478-1 Commit: 8629b50d6ff490fa2a13f829f9dc35661a3fdbeb Parents: f104976 Author: Pavel Tupitsyn <[email protected]> Authored: Thu Aug 31 14:06:47 2017 +0300 Committer: Pavel Tupitsyn <[email protected]> Committed: Thu Aug 31 14:06:47 2017 +0300 ---------------------------------------------------------------------- .../Apache.Ignite.Core.csproj | 1 + .../Impl/Binary/BinaryObjectSchemaSerializer.cs | 10 +-- .../Impl/Binary/Marshaller.cs | 4 +- .../Impl/Cache/CacheAffinityImpl.cs | 2 +- .../Apache.Ignite.Core/Impl/Cache/CacheImpl.cs | 2 +- .../Impl/Cluster/ClusterGroupImpl.cs | 2 +- .../Impl/Compute/Closure/ComputeActionJob.cs | 2 +- .../Impl/Compute/Closure/ComputeFuncJob.cs | 2 +- .../Impl/Compute/Closure/ComputeOutFuncJob.cs | 2 +- .../Closure/ComputeReducingClosureTask.cs | 2 +- .../Compute/Closure/IComputeResourceInjector.cs | 2 +- .../Impl/Compute/ComputeJobHolder.cs | 19 ++---- .../Impl/Deployment/PeerAssemblyResolver.cs | 13 ++-- .../Impl/Deployment/PeerLoadingObjectHolder.cs | 2 +- .../Apache.Ignite.Core/Impl/ExceptionUtils.cs | 8 +-- .../Apache.Ignite.Core/Impl/IIgniteInternal.cs | 69 ++++++++++++++++++++ .../dotnet/Apache.Ignite.Core/Impl/Ignite.cs | 13 ++-- .../Impl/Messaging/MessageListenerHolder.cs | 2 +- .../Impl/PlatformTargetAdapter.cs | 13 +--- .../Impl/Resource/ResourceProcessor.cs | 2 +- .../Impl/Resource/ResourceTypeDescriptor.cs | 2 +- 21 files changed, 116 insertions(+), 58 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/8629b50d/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 c444ed0..ee301be 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj @@ -99,6 +99,7 @@ <Compile Include="Cache\IMemoryMetrics.cs" /> <Compile Include="Common\ExceptionFactory.cs" /> <Compile Include="Configuration\Package-Info.cs" /> + <Compile Include="Impl\IIgniteInternal.cs" /> <Compile Include="Impl\IPlatformTargetInternal.cs" /> <Compile Include="Impl\PersistentStore\PersistentStoreMetrics.cs" /> <Compile Include="Impl\PlatformDisposableTargetAdapter.cs" /> http://git-wip-us.apache.org/repos/asf/ignite/blob/8629b50d/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryObjectSchemaSerializer.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryObjectSchemaSerializer.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryObjectSchemaSerializer.cs index 1d699c2..2f66f66 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryObjectSchemaSerializer.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryObjectSchemaSerializer.cs @@ -59,7 +59,7 @@ namespace Apache.Ignite.Core.Impl.Binary /// Schema. /// </returns> public static BinaryObjectSchemaField[] ReadSchema(IBinaryStream stream, int position, BinaryObjectHeader hdr, - BinaryObjectSchema schema, Ignite ignite) + BinaryObjectSchema schema, IIgniteInternal ignite) { Debug.Assert(stream != null); Debug.Assert(schema != null); @@ -252,7 +252,7 @@ namespace Apache.Ignite.Core.Impl.Binary /// <summary> /// Gets the field ids. /// </summary> - private static int[] GetFieldIds(BinaryObjectHeader hdr, Ignite ignite) + private static int[] GetFieldIds(BinaryObjectHeader hdr, IIgniteInternal ignite) { Debug.Assert(hdr.TypeId != BinaryUtils.TypeUnregistered); @@ -268,13 +268,15 @@ namespace Apache.Ignite.Core.Impl.Binary throw new BinaryObjectException("Cannot find schema for object with compact footer [" + "typeId=" + hdr.TypeId + ", schemaId=" + hdr.SchemaId + ']'); } + return fieldIds; } /// <summary> /// Reads the schema, maintains stream position. /// </summary> - public static int[] GetFieldIds(BinaryObjectHeader hdr, Ignite ignite, IBinaryStream stream, int objectPos) + public static int[] GetFieldIds(BinaryObjectHeader hdr, IIgniteInternal ignite, IBinaryStream stream, + int objectPos) { Debug.Assert(stream != null); @@ -309,7 +311,7 @@ namespace Apache.Ignite.Core.Impl.Binary /// <summary> /// Gets the field ids. /// </summary> - private static int[] GetFieldIds(BinaryObjectHeader hdr, BinaryObjectSchema schema, Ignite ignite) + private static int[] GetFieldIds(BinaryObjectHeader hdr, BinaryObjectSchema schema, IIgniteInternal ignite) { return schema.Get(hdr.SchemaId) ?? GetFieldIds(hdr, ignite); } http://git-wip-us.apache.org/repos/asf/ignite/blob/8629b50d/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Marshaller.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Marshaller.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Marshaller.cs index a6d5517..d78276d 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Marshaller.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Marshaller.cs @@ -61,7 +61,7 @@ namespace Apache.Ignite.Core.Impl.Binary private volatile IDictionary<int, BinaryTypeHolder> _metas = new Dictionary<int, BinaryTypeHolder>(); /** */ - private volatile Ignite _ignite; + private volatile IIgniteInternal _ignite; /** */ private readonly ILogger _log; @@ -110,7 +110,7 @@ namespace Apache.Ignite.Core.Impl.Binary /// <summary> /// Gets or sets the backing grid. /// </summary> - public Ignite Ignite + public IIgniteInternal Ignite { get { return _ignite; } set http://git-wip-us.apache.org/repos/asf/ignite/blob/8629b50d/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheAffinityImpl.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheAffinityImpl.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheAffinityImpl.cs index a2bba29..f8a2499 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheAffinityImpl.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheAffinityImpl.cs @@ -79,7 +79,7 @@ namespace Apache.Ignite.Core.Impl.Cache private readonly bool _keepBinary; /** Grid. */ - private readonly Ignite _ignite; + private readonly IIgniteInternal _ignite; /// <summary> /// Initializes a new instance of the <see cref="CacheAffinityImpl" /> class. http://git-wip-us.apache.org/repos/asf/ignite/blob/8629b50d/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 06d01c0..64eee8d 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheImpl.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheImpl.cs @@ -45,7 +45,7 @@ namespace Apache.Ignite.Core.Impl.Cache internal class CacheImpl<TK, TV> : PlatformTargetAdapter, ICache<TK, TV>, ICacheInternal, ICacheLockInternal { /** Ignite instance. */ - private readonly Ignite _ignite; + private readonly IIgniteInternal _ignite; /** Flag: skip store. */ private readonly bool _flagSkipStore; http://git-wip-us.apache.org/repos/asf/ignite/blob/8629b50d/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cluster/ClusterGroupImpl.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cluster/ClusterGroupImpl.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cluster/ClusterGroupImpl.cs index 678fb03..6d6756f 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cluster/ClusterGroupImpl.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cluster/ClusterGroupImpl.cs @@ -146,7 +146,7 @@ namespace Apache.Ignite.Core.Impl.Cluster private const int OpGetServices = 34; /** Initial Ignite instance. */ - private readonly Ignite _ignite; + private readonly IIgniteInternal _ignite; /** Predicate. */ private readonly Func<IClusterNode, bool> _pred; http://git-wip-us.apache.org/repos/asf/ignite/blob/8629b50d/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 6db1055..e44018b 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 @@ -56,7 +56,7 @@ namespace Apache.Ignite.Core.Impl.Compute.Closure } /** <inheritDoc /> */ - public void Inject(Ignite grid) + public void Inject(IIgniteInternal grid) { ResourceProcessor.Inject(_action, grid); } http://git-wip-us.apache.org/repos/asf/ignite/blob/8629b50d/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 ecb4b98..3c7cec8 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 @@ -58,7 +58,7 @@ namespace Apache.Ignite.Core.Impl.Compute.Closure } /** <inheritDoc /> */ - public void Inject(Ignite grid) + public void Inject(IIgniteInternal grid) { ResourceProcessor.Inject(_clo, grid); } http://git-wip-us.apache.org/repos/asf/ignite/blob/8629b50d/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 9652794..af03e3d 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 @@ -52,7 +52,7 @@ namespace Apache.Ignite.Core.Impl.Compute.Closure } /** <inheritDoc /> */ - public void Inject(Ignite grid) + public void Inject(IIgniteInternal grid) { ResourceProcessor.Inject(_clo, grid); } http://git-wip-us.apache.org/repos/asf/ignite/blob/8629b50d/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 d1dab05..4c81c9a 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 @@ -55,7 +55,7 @@ namespace Apache.Ignite.Core.Impl.Compute.Closure } /** <inheritDoc /> */ - public void Inject(Ignite grid) + public void Inject(IIgniteInternal grid) { ResourceProcessor.Inject(_rdc, grid); } http://git-wip-us.apache.org/repos/asf/ignite/blob/8629b50d/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/Closure/IComputeResourceInjector.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/Closure/IComputeResourceInjector.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/Closure/IComputeResourceInjector.cs index 8d3e8d7..7ef3d92 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/Closure/IComputeResourceInjector.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/Closure/IComputeResourceInjector.cs @@ -26,6 +26,6 @@ namespace Apache.Ignite.Core.Impl.Compute.Closure /// Inject resources. /// </summary> /// <param name="grid">Grid.</param> - void Inject(Ignite grid); + void Inject(IIgniteInternal grid); } } http://git-wip-us.apache.org/repos/asf/ignite/blob/8629b50d/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 5c009ac..945f2ab 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeJobHolder.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeJobHolder.cs @@ -24,7 +24,6 @@ namespace Apache.Ignite.Core.Impl.Compute using Apache.Ignite.Core.Common; using Apache.Ignite.Core.Impl.Binary; using Apache.Ignite.Core.Impl.Binary.IO; - using Apache.Ignite.Core.Impl.Cluster; using Apache.Ignite.Core.Impl.Compute.Closure; using Apache.Ignite.Core.Impl.Deployment; using Apache.Ignite.Core.Impl.Memory; @@ -39,7 +38,7 @@ namespace Apache.Ignite.Core.Impl.Compute private readonly IComputeJob _job; /** Owning grid. */ - private readonly Ignite _ignite; + private readonly IIgniteInternal _ignite; /** Result (set for local jobs only). */ private volatile ComputeJobResultImpl _jobRes; @@ -62,7 +61,7 @@ namespace Apache.Ignite.Core.Impl.Compute /// </summary> /// <param name="grid">Grid.</param> /// <param name="job">Job.</param> - public ComputeJobHolder(Ignite grid, IComputeJob job) + public ComputeJobHolder(IIgniteInternal grid, IComputeJob job) { Debug.Assert(grid != null); Debug.Assert(job != null); @@ -87,7 +86,7 @@ namespace Apache.Ignite.Core.Impl.Compute success ? null : new IgniteException("Compute job has failed on local node, " + "examine InnerException for details.", (Exception) res), _job, - _ignite.GetLocalNode().Id, + _ignite.GetCluster().GetLocalNode().Id, cancel ); } @@ -109,9 +108,7 @@ namespace Apache.Ignite.Core.Impl.Compute } // 2. Try writing result to the stream. - ClusterGroupImpl prj = _ignite.ClusterGroup; - - BinaryWriter writer = prj.Marshaller.StartMarshal(stream); + var writer = _ignite.Marshaller.StartMarshal(stream); try { @@ -121,7 +118,7 @@ namespace Apache.Ignite.Core.Impl.Compute finally { // 4. Process metadata. - prj.FinishMarshal(writer); + _ignite.Marshaller.FinishMarshal(writer); } } @@ -142,9 +139,7 @@ namespace Apache.Ignite.Core.Impl.Compute Justification = "User job can throw any exception")] internal bool Serialize(IBinaryStream stream) { - ClusterGroupImpl prj = _ignite.ClusterGroup; - - BinaryWriter writer = prj.Marshaller.StartMarshal(stream); + BinaryWriter writer = _ignite.Marshaller.StartMarshal(stream); try { @@ -162,7 +157,7 @@ namespace Apache.Ignite.Core.Impl.Compute finally { // 4. Process metadata. - prj.FinishMarshal(writer); + _ignite.Marshaller.FinishMarshal(writer); } } http://git-wip-us.apache.org/repos/asf/ignite/blob/8629b50d/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Deployment/PeerAssemblyResolver.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Deployment/PeerAssemblyResolver.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Deployment/PeerAssemblyResolver.cs index b81bbbc..e22e325 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Deployment/PeerAssemblyResolver.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Deployment/PeerAssemblyResolver.cs @@ -39,7 +39,7 @@ namespace Apache.Ignite.Core.Impl.Deployment /// <summary> /// Initializes a new instance of the <see cref="PeerAssemblyResolver"/> class. /// </summary> - public PeerAssemblyResolver(Ignite ignite, Guid originNodeId) + public PeerAssemblyResolver(IIgniteInternal ignite, Guid originNodeId) { Debug.Assert(ignite != null); @@ -59,7 +59,7 @@ namespace Apache.Ignite.Core.Impl.Deployment /// <summary> /// Gets an instance of <see cref="PeerAssemblyResolver"/> when peer loading is enabled; otherwise null. /// </summary> - public static PeerAssemblyResolver GetInstance(Ignite ignite, Guid originNodeId) + public static PeerAssemblyResolver GetInstance(IIgniteInternal ignite, Guid originNodeId) { if (ignite == null || ignite.Configuration.PeerAssemblyLoadingMode == PeerAssemblyLoadingMode.Disabled) { @@ -78,7 +78,7 @@ namespace Apache.Ignite.Core.Impl.Deployment /// <returns> /// Resulting type or null. /// </returns> - public static Type LoadAssemblyAndGetType(string typeName, Ignite ignite, Guid originNodeId) + public static Type LoadAssemblyAndGetType(string typeName, IIgniteInternal ignite, Guid originNodeId) { Debug.Assert(!string.IsNullOrEmpty(typeName)); @@ -102,7 +102,7 @@ namespace Apache.Ignite.Core.Impl.Deployment /// <summary> /// Gets the assembly. /// </summary> - private static Assembly GetAssembly(Ignite ignite, string assemblyName, Guid originNodeId) + private static Assembly GetAssembly(IIgniteInternal ignite, string assemblyName, Guid originNodeId) { return LoadedAssembliesResolver.Instance.GetAssembly(assemblyName) ?? AssemblyLoader.GetAssembly(assemblyName) @@ -112,7 +112,7 @@ namespace Apache.Ignite.Core.Impl.Deployment /// <summary> /// Loads the assembly. /// </summary> - private static Assembly LoadAssembly(Ignite ignite, string assemblyName, Guid originNodeId) + private static Assembly LoadAssembly(IIgniteInternal ignite, string assemblyName, Guid originNodeId) { var res = RequestAssembly(assemblyName, ignite, originNodeId); @@ -132,7 +132,8 @@ namespace Apache.Ignite.Core.Impl.Deployment /// Successful result or null. /// </returns> /// <exception cref="IgniteException"></exception> - private static AssemblyRequestResult RequestAssembly(string assemblyName, Ignite ignite, Guid originNodeId) + private static AssemblyRequestResult RequestAssembly(string assemblyName, IIgniteInternal ignite, + Guid originNodeId) { Debug.Assert(assemblyName != null); Debug.Assert(ignite != null); http://git-wip-us.apache.org/repos/asf/ignite/blob/8629b50d/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Deployment/PeerLoadingObjectHolder.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Deployment/PeerLoadingObjectHolder.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Deployment/PeerLoadingObjectHolder.cs index 9457538..c3546bc 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Deployment/PeerLoadingObjectHolder.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Deployment/PeerLoadingObjectHolder.cs @@ -82,7 +82,7 @@ namespace Apache.Ignite.Core.Impl.Deployment { var writer0 = (BinaryWriter) writer.GetRawWriter(); - writer0.WriteGuid(writer0.Marshaller.Ignite.GetLocalNode().Id); + writer0.WriteGuid(writer0.Marshaller.Ignite.GetCluster().GetLocalNode().Id); writer0.WriteString(_object.GetType().AssemblyQualifiedName); writer0.WriteObjectDetached(_object); } http://git-wip-us.apache.org/repos/asf/ignite/blob/8629b50d/modules/platforms/dotnet/Apache.Ignite.Core/Impl/ExceptionUtils.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/ExceptionUtils.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/ExceptionUtils.cs index ebfcc28..c0c261b 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/ExceptionUtils.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/ExceptionUtils.cs @@ -118,7 +118,7 @@ namespace Apache.Ignite.Core.Impl /// <param name="reader">Error data reader.</param> /// <param name="innerException">Inner exception.</param> /// <returns>Exception.</returns> - public static Exception GetException(Ignite ignite, string clsName, string msg, string stackTrace, + public static Exception GetException(IIgniteInternal ignite, string clsName, string msg, string stackTrace, BinaryReader reader = null, Exception innerException = null) { // Set JavaException as immediate inner. @@ -153,7 +153,7 @@ namespace Apache.Ignite.Core.Impl return ProcessCachePartialUpdateException(ignite, msg, stackTrace, reader); // Predefined mapping not found - check plugins. - if (ignite != null) + if (ignite != null && ignite.PluginProcessor != null) { ctor = ignite.PluginProcessor.GetExceptionMapping(clsName); @@ -177,8 +177,8 @@ namespace Apache.Ignite.Core.Impl /// <param name="reader">Reader.</param> /// <returns>CachePartialUpdateException.</returns> [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes")] - private static Exception ProcessCachePartialUpdateException(Ignite ignite, string msg, string stackTrace, - BinaryReader reader) + private static Exception ProcessCachePartialUpdateException(IIgniteInternal ignite, string msg, + string stackTrace, BinaryReader reader) { if (reader == null) return new CachePartialUpdateException(msg, new IgniteException("Failed keys are not available.")); http://git-wip-us.apache.org/repos/asf/ignite/blob/8629b50d/modules/platforms/dotnet/Apache.Ignite.Core/Impl/IIgniteInternal.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/IIgniteInternal.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/IIgniteInternal.cs new file mode 100644 index 0000000..789633b --- /dev/null +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/IIgniteInternal.cs @@ -0,0 +1,69 @@ +/* + * 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 +{ + using System; + using Apache.Ignite.Core.Datastream; + using Apache.Ignite.Core.Impl.Binary; + using Apache.Ignite.Core.Impl.Cluster; + using Apache.Ignite.Core.Impl.Handle; + using Apache.Ignite.Core.Impl.Plugin; + + /// <summary> + /// Internal Ignite interface. + /// </summary> + internal interface IIgniteInternal : IIgnite + { + /// <summary> + /// Gets the binary processor. + /// </summary> + BinaryProcessor BinaryProcessor { get; } + + /// <summary> + /// Configuration. + /// </summary> + IgniteConfiguration Configuration { get; } + + /// <summary> + /// Handle registry. + /// </summary> + HandleRegistry HandleRegistry { get; } + + /// <summary> + /// Gets the node from cache. + /// </summary> + /// <param name="id">Node id.</param> + /// <returns>Cached node.</returns> + ClusterNodeImpl GetNode(Guid? id); + + /// <summary> + /// Gets the marshaller. + /// </summary> + Marshaller Marshaller { get; } + + /// <summary> + /// Gets the plugin processor. + /// </summary> + PluginProcessor PluginProcessor { get; } + + /// <summary> + /// Gets the data streamer. + /// </summary> + IDataStreamer<TK, TV> GetDataStreamer<TK, TV>(string cacheName, bool keepBinary); + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/8629b50d/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Ignite.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Ignite.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Ignite.cs index aae6ce7..630aa85 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Ignite.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Ignite.cs @@ -55,7 +55,7 @@ namespace Apache.Ignite.Core.Impl /// <summary> /// Native Ignite wrapper. /// </summary> - internal class Ignite : PlatformTargetAdapter, IIgnite, ICluster + internal class Ignite : PlatformTargetAdapter, ICluster, IIgniteInternal { /// <summary> /// Operation codes for PlatformProcessorImpl calls. @@ -211,7 +211,6 @@ namespace Apache.Ignite.Core.Impl } /** <inheritdoc /> */ - public ICluster GetCluster() { return this; @@ -569,7 +568,7 @@ namespace Apache.Ignite.Core.Impl /// <summary> /// Gets the data streamer. /// </summary> - internal IDataStreamer<TK, TV> GetDataStreamer<TK, TV>(string cacheName, bool keepBinary) + public IDataStreamer<TK, TV> GetDataStreamer<TK, TV>(string cacheName, bool keepBinary) { var streamerTarget = DoOutOpObject((int) Op.GetDataStreamer, w => { @@ -797,7 +796,7 @@ namespace Apache.Ignite.Core.Impl /// Gets internal projection. /// </summary> /// <returns>Projection.</returns> - internal ClusterGroupImpl ClusterGroup + public ClusterGroupImpl ClusterGroup { get { return _prj; } } @@ -805,7 +804,7 @@ namespace Apache.Ignite.Core.Impl /// <summary> /// Gets the binary processor. /// </summary> - internal BinaryProcessor BinaryProcessor + public BinaryProcessor BinaryProcessor { get { return _binaryProc; } } @@ -813,7 +812,7 @@ namespace Apache.Ignite.Core.Impl /// <summary> /// Configuration. /// </summary> - internal IgniteConfiguration Configuration + public IgniteConfiguration Configuration { get { return _cfg; } } @@ -889,7 +888,7 @@ namespace Apache.Ignite.Core.Impl /// <summary> /// Gets the plugin processor. /// </summary> - internal PluginProcessor PluginProcessor + public PluginProcessor PluginProcessor { get { return _pluginProcessor; } } http://git-wip-us.apache.org/repos/asf/ignite/blob/8629b50d/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 6e4e9f7..457533a 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Messaging/MessageListenerHolder.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Messaging/MessageListenerHolder.cs @@ -36,7 +36,7 @@ namespace Apache.Ignite.Core.Impl.Messaging private readonly Func<Guid, object, bool> _invoker; /** Current Ignite instance. */ - private readonly Ignite _ignite; + private readonly IIgniteInternal _ignite; /** Underlying filter. */ private readonly object _filter; http://git-wip-us.apache.org/repos/asf/ignite/blob/8629b50d/modules/platforms/dotnet/Apache.Ignite.Core/Impl/PlatformTargetAdapter.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/PlatformTargetAdapter.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/PlatformTargetAdapter.cs index 64b5f29..ec3a637 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/PlatformTargetAdapter.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/PlatformTargetAdapter.cs @@ -79,7 +79,7 @@ namespace Apache.Ignite.Core.Impl /// <summary> /// Unmanaged target. /// </summary> - internal IPlatformTargetInternal Target + public IPlatformTargetInternal Target { get { return _target; } } @@ -87,7 +87,7 @@ namespace Apache.Ignite.Core.Impl /// <summary> /// Marshaller. /// </summary> - internal Marshaller Marshaller + public Marshaller Marshaller { get { return _marsh; } } @@ -406,15 +406,6 @@ namespace Apache.Ignite.Core.Impl #region Miscelanneous /// <summary> - /// Finish marshaling. - /// </summary> - /// <param name="writer">Writer.</param> - internal void FinishMarshal(BinaryWriter writer) - { - _marsh.FinishMarshal(writer); - } - - /// <summary> /// Unmarshal object using the given stream. /// </summary> /// <param name="stream">Stream.</param> http://git-wip-us.apache.org/repos/asf/ignite/blob/8629b50d/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Resource/ResourceProcessor.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Resource/ResourceProcessor.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Resource/ResourceProcessor.cs index fc677b0..6e37006 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Resource/ResourceProcessor.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Resource/ResourceProcessor.cs @@ -71,7 +71,7 @@ namespace Apache.Ignite.Core.Impl.Resource /// </summary> /// <param name="target">Target object.</param> /// <param name="grid">Grid.</param> - public static void Inject(object target, Ignite grid) + public static void Inject(object target, IIgniteInternal grid) { if (target != null) { var desc = Descriptor(target.GetType()); http://git-wip-us.apache.org/repos/asf/ignite/blob/8629b50d/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Resource/ResourceTypeDescriptor.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Resource/ResourceTypeDescriptor.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Resource/ResourceTypeDescriptor.cs index 3a3f629..609ccfd 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Resource/ResourceTypeDescriptor.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Resource/ResourceTypeDescriptor.cs @@ -87,7 +87,7 @@ namespace Apache.Ignite.Core.Impl.Resource /// </summary> /// <param name="target">Target.</param> /// <param name="ignite">Grid.</param> - public void InjectIgnite(object target, Ignite ignite) + public void InjectIgnite(object target, IIgniteInternal ignite) { Inject0(target, ignite, _igniteInjectors); }
