ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [12/19] ignite git commit: IGNITE-5770 Refactor PlatformProcessor to PlatformTarget mechanism
Date Wed, 26 Jul 2017 10:53:28 GMT
http://git-wip-us.apache.org/repos/asf/ignite/blob/bdc9e4b9/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedUtils.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedUtils.cs
b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedUtils.cs
index f76bbac..a38cf2f 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedUtils.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedUtils.cs
@@ -93,12 +93,9 @@ namespace Apache.Ignite.Core.Impl.Unmanaged
 
                 try
                 {
-                    // OnStart receives the same InteropProcessor as here (just as another
GlobalRef) and stores it.
-                    // Release current reference immediately.
-                    void* res = JNI.IgnitionStart(ctx.NativeContext, cfgPath0, gridName0,
InteropFactoryId,
+                    // OnStart receives InteropProcessor referece and stores it.
+                    JNI.IgnitionStart(ctx.NativeContext, cfgPath0, gridName0, InteropFactoryId,
                         mem.SynchronizeOutput());
-
-                    JNI.Release(res);
                 }
                 finally
                 {
@@ -122,304 +119,6 @@ namespace Apache.Ignite.Core.Impl.Unmanaged
             }
         }
 
-        internal static void IgnitionStopAll(void* ctx, bool cancel)
-        {
-            JNI.IgnitionStopAll(ctx, cancel);
-        }
-
-        internal static void ProcessorReleaseStart(IUnmanagedTarget target)
-        {
-            JNI.ProcessorReleaseStart(target.Context, target.Target);
-        }
-
-        internal static IUnmanagedTarget ProcessorProjection(IUnmanagedTarget target)
-        {
-            void* res = JNI.ProcessorProjection(target.Context, target.Target);
-
-            return target.ChangeTarget(res);
-        }
-
-        internal static IUnmanagedTarget ProcessorCache(IUnmanagedTarget target, string name)
-        {
-            sbyte* name0 = IgniteUtils.StringToUtf8Unmanaged(name);
-
-            try
-            {
-                void* res = JNI.ProcessorCache(target.Context, target.Target, name0);
-
-                return target.ChangeTarget(res);
-            }
-            finally
-            {
-                Marshal.FreeHGlobal(new IntPtr(name0));
-            }
-        }
-
-        internal static IUnmanagedTarget ProcessorCreateCache(IUnmanagedTarget target, string
name)
-        {
-            sbyte* name0 = IgniteUtils.StringToUtf8Unmanaged(name);
-
-            try
-            {
-                void* res = JNI.ProcessorCreateCache(target.Context, target.Target, name0);
-
-                return target.ChangeTarget(res);
-            }
-            finally
-            {
-                Marshal.FreeHGlobal(new IntPtr(name0));
-            }
-        }
-
-        internal static IUnmanagedTarget ProcessorCreateCache(IUnmanagedTarget target, long
memPtr)
-        {
-            void* res = JNI.ProcessorCreateCacheFromConfig(target.Context, target.Target,
memPtr);
-
-            return target.ChangeTarget(res);
-        }
-
-        internal static IUnmanagedTarget ProcessorGetOrCreateCache(IUnmanagedTarget target,
string name)
-        {
-            sbyte* name0 = IgniteUtils.StringToUtf8Unmanaged(name);
-
-            try
-            {
-                void* res = JNI.ProcessorGetOrCreateCache(target.Context, target.Target,
name0);
-
-                return target.ChangeTarget(res);
-            }
-            finally
-            {
-                Marshal.FreeHGlobal(new IntPtr(name0));
-            }
-        }
-
-        internal static IUnmanagedTarget ProcessorGetOrCreateCache(IUnmanagedTarget target,
long memPtr)
-        {
-            void* res = JNI.ProcessorGetOrCreateCacheFromConfig(target.Context, target.Target,
memPtr);
-
-            return target.ChangeTarget(res);
-        }
-
-        internal static IUnmanagedTarget ProcessorCreateNearCache(IUnmanagedTarget target,
string name, long memPtr)
-        {
-            sbyte* name0 = IgniteUtils.StringToUtf8Unmanaged(name);
-
-            try
-            {
-                void* res = JNI.ProcessorCreateNearCache(target.Context, target.Target, name0,
memPtr);
-
-                return target.ChangeTarget(res);
-            }
-            finally
-            {
-                Marshal.FreeHGlobal(new IntPtr(name0));
-            }
-        }
-
-        internal static IUnmanagedTarget ProcessorGetOrCreateNearCache(IUnmanagedTarget target,
string name, long memPtr)
-        {
-            sbyte* name0 = IgniteUtils.StringToUtf8Unmanaged(name);
-
-            try
-            {
-                void* res = JNI.ProcessorGetOrCreateNearCache(target.Context, target.Target,
name0, memPtr);
-
-                return target.ChangeTarget(res);
-            }
-            finally
-            {
-                Marshal.FreeHGlobal(new IntPtr(name0));
-            }
-        }
-
-        internal static void ProcessorDestroyCache(IUnmanagedTarget target, string name)
-        {
-            sbyte* name0 = IgniteUtils.StringToUtf8Unmanaged(name);
-
-            try
-            {
-                JNI.ProcessorDestroyCache(target.Context, target.Target, name0);
-            }
-            finally
-            {
-                Marshal.FreeHGlobal(new IntPtr(name0));
-            }
-        }
-
-        internal static IUnmanagedTarget ProcessorAffinity(IUnmanagedTarget target, string
name)
-        {
-            sbyte* name0 = IgniteUtils.StringToUtf8Unmanaged(name);
-
-            try
-            {
-                void* res = JNI.ProcessorAffinity(target.Context, target.Target, name0);
-
-                return target.ChangeTarget(res);
-            }
-            finally
-            {
-                Marshal.FreeHGlobal(new IntPtr(name0));
-            }
-        }
-
-        internal static IUnmanagedTarget ProcessorDataStreamer(IUnmanagedTarget target, string
name, bool keepBinary)
-        {
-            sbyte* name0 = IgniteUtils.StringToUtf8Unmanaged(name);
-
-            try
-            {
-                void* res = JNI.ProcessorDataStreamer(target.Context, target.Target, name0,
keepBinary);
-
-                return target.ChangeTarget(res);
-            }
-            finally
-            {
-                Marshal.FreeHGlobal(new IntPtr(name0));
-            }
-        }
-        
-        internal static IUnmanagedTarget ProcessorTransactions(IUnmanagedTarget target)
-        {
-            void* res = JNI.ProcessorTransactions(target.Context, target.Target);
-
-            return target.ChangeTarget(res);
-        }
-
-        internal static IUnmanagedTarget ProcessorCompute(IUnmanagedTarget target, IUnmanagedTarget
prj)
-        {
-            void* res = JNI.ProcessorCompute(target.Context, target.Target, prj.Target);
-
-            return target.ChangeTarget(res);
-        }
-
-        internal static IUnmanagedTarget ProcessorMessage(IUnmanagedTarget target, IUnmanagedTarget
prj)
-        {
-            void* res = JNI.ProcessorMessage(target.Context, target.Target, prj.Target);
-
-            return target.ChangeTarget(res);
-        }
-
-        internal static IUnmanagedTarget ProcessorEvents(IUnmanagedTarget target, IUnmanagedTarget
prj)
-        {
-            void* res = JNI.ProcessorEvents(target.Context, target.Target, prj.Target);
-
-            return target.ChangeTarget(res);
-        }
-
-        internal static IUnmanagedTarget ProcessorServices(IUnmanagedTarget target, IUnmanagedTarget
prj)
-        {
-            void* res = JNI.ProcessorServices(target.Context, target.Target, prj.Target);
-
-            return target.ChangeTarget(res);
-        }
-
-        internal static IUnmanagedTarget ProcessorExtensions(IUnmanagedTarget target)
-        {
-            void* res = JNI.ProcessorExtensions(target.Context, target.Target);
-
-            return target.ChangeTarget(res);
-        }
-
-        internal static IUnmanagedTarget ProcessorExtension(IUnmanagedTarget target, int
id)
-        {
-            void* res = JNI.ProcessorExtension(target.Context, target.Target, id);
-
-            return target.ChangeTarget(res);
-        }
-
-        internal static IUnmanagedTarget ProcessorAtomicLong(IUnmanagedTarget target, string
name, long initialValue, 
-            bool create)
-        {
-            var name0 = IgniteUtils.StringToUtf8Unmanaged(name);
-
-            try
-            {
-                var res = JNI.ProcessorAtomicLong(target.Context, target.Target, name0, initialValue,
create);
-
-                return res == null ? null : target.ChangeTarget(res);
-            }
-            finally
-            {
-                Marshal.FreeHGlobal(new IntPtr(name0));
-            }
-        }
-
-        internal static IUnmanagedTarget ProcessorAtomicSequence(IUnmanagedTarget target,
string name, long initialValue, 
-            bool create)
-        {
-            var name0 = IgniteUtils.StringToUtf8Unmanaged(name);
-
-            try
-            {
-                var res = JNI.ProcessorAtomicSequence(target.Context, target.Target, name0,
initialValue, create);
-
-                return res == null ? null : target.ChangeTarget(res);
-            }
-            finally
-            {
-                Marshal.FreeHGlobal(new IntPtr(name0));
-            }
-        }
-
-        internal static IUnmanagedTarget ProcessorAtomicReference(IUnmanagedTarget target,
string name, long memPtr, 
-            bool create)
-        {
-            var name0 = IgniteUtils.StringToUtf8Unmanaged(name);
-
-            try
-            {
-                var res = JNI.ProcessorAtomicReference(target.Context, target.Target, name0,
memPtr, create);
-
-                return res == null ? null : target.ChangeTarget(res);
-            }
-            finally
-            {
-                Marshal.FreeHGlobal(new IntPtr(name0));
-            }
-        }
-
-        internal static void ProcessorGetIgniteConfiguration(IUnmanagedTarget target, long
memPtr)
-        {
-            JNI.ProcessorGetIgniteConfiguration(target.Context, target.Target, memPtr);
-        }
-
-        internal static void ProcessorGetCacheNames(IUnmanagedTarget target, long memPtr)
-        {
-            JNI.ProcessorGetCacheNames(target.Context, target.Target, memPtr);
-        }
-
-        internal static bool ProcessorLoggerIsLevelEnabled(IUnmanagedTarget target, int level)
-        {
-            return JNI.ProcessorLoggerIsLevelEnabled(target.Context, target.Target, level);
-        }
-
-        internal static void ProcessorLoggerLog(IUnmanagedTarget target, int level, string
message, string category,
-            string errorInfo)
-        {
-            var message0 = IgniteUtils.StringToUtf8Unmanaged(message);
-            var category0 = IgniteUtils.StringToUtf8Unmanaged(category);
-            var errorInfo0 = IgniteUtils.StringToUtf8Unmanaged(errorInfo);
-
-            try
-            {
-                JNI.ProcessorLoggerLog(target.Context, target.Target, level, message0, category0,
errorInfo0);
-            }
-            finally
-            {
-                Marshal.FreeHGlobal(new IntPtr(message0));
-                Marshal.FreeHGlobal(new IntPtr(category0));
-                Marshal.FreeHGlobal(new IntPtr(errorInfo0));
-            }
-        }
-
-        internal static IUnmanagedTarget ProcessorBinaryProcessor(IUnmanagedTarget target)
-        {
-            void* res = JNI.ProcessorBinaryProcessor(target.Context, target.Target);
-
-            return target.ChangeTarget(res);
-        }
-
         #endregion
 
         #region NATIVE METHODS: TARGET
@@ -443,6 +142,9 @@ namespace Apache.Ignite.Core.Impl.Unmanaged
         {
             void* res = JNI.TargetInStreamOutObject(target.Context, target.Target, opType,
inMemPtr);
 
+            if (res == null)
+                return null;
+
             return target.ChangeTarget(res);
         }
 


Mime
View raw message