/// <param name="context">Context.</param> public void SetContext(void *context) { Debug.Assert(context != null); Debug.Assert(_ctx == null); _ctx = new UnmanagedContext(context); }
internal static void IgnitionStart(UnmanagedContext ctx, string cfgPath, string gridName, bool clientMode, bool userLogger) { using (var mem = IgniteManager.Memory.Allocate().GetStream()) { mem.WriteBool(clientMode); mem.WriteBool(userLogger); sbyte* cfgPath0 = IgniteUtils.StringToUtf8Unmanaged(cfgPath); sbyte* gridName0 = IgniteUtils.StringToUtf8Unmanaged(gridName); 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, mem.SynchronizeOutput()); JNI.Release(res); } finally { Marshal.FreeHGlobal(new IntPtr(cfgPath0)); Marshal.FreeHGlobal(new IntPtr(gridName0)); } } }
internal static void IgnitionStart(UnmanagedContext ctx, string cfgPath, string gridName, bool clientMode, bool userLogger) { using (var mem = IgniteManager.Memory.Allocate().GetStream()) { mem.WriteBool(clientMode); mem.WriteBool(userLogger); sbyte *cfgPath0 = IgniteUtils.StringToUtf8Unmanaged(cfgPath); sbyte *gridName0 = IgniteUtils.StringToUtf8Unmanaged(gridName); 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, mem.SynchronizeOutput()); JNI.Release(res); } finally { Marshal.FreeHGlobal(new IntPtr(cfgPath0)); Marshal.FreeHGlobal(new IntPtr(gridName0)); } } }
/// <summary> /// Constructor. /// </summary> /// <param name="ctx">Context.</param> /// <param name="target">Target.</param> public UnmanagedTarget(UnmanagedContext ctx, void* target) : base(IntPtr.Zero) { _ctx = ctx; SetHandle(new IntPtr(target)); }
/// <summary> /// Constructor. /// </summary> /// <param name="ctx">Context.</param> /// <param name="target">Target.</param> public UnmanagedTarget(UnmanagedContext ctx, void *target) : base(IntPtr.Zero) { _ctx = ctx; SetHandle(new IntPtr(target)); }
private void OnStop(void *target) { Marshal.FreeHGlobal(_cbsPtr); // ReSharper disable once ImpureMethodCallOnReadonlyValueField _thisHnd.Free(); // Allow context to be collected, which will cause resource cleanup in finalizer. _ctx = null; }
private void OnStop(void *target) { Marshal.FreeHGlobal(_cbsPtr); // ReSharper disable once ImpureMethodCallOnReadonlyValueField _thisHnd.Free(); // Allow context to be collected, which will cause resource cleanup in finalizer. _ctx = null; // Notify grid var ignite = _ignite; if (ignite != null) { ignite.AfterNodeStop(); } }
internal static IUnmanagedTarget IgnitionStart(UnmanagedContext ctx, string cfgPath, string gridName, bool clientMode) { using (var mem = IgniteManager.Memory.Allocate().GetStream()) { mem.WriteBool(clientMode); sbyte* cfgPath0 = IgniteUtils.StringToUtf8Unmanaged(cfgPath); sbyte* gridName0 = IgniteUtils.StringToUtf8Unmanaged(gridName); try { void* res = JNI.IgnitionStart(ctx.NativeContext, cfgPath0, gridName0, InteropFactoryId, mem.SynchronizeOutput()); return new UnmanagedTarget(ctx, res); } finally { Marshal.FreeHGlobal(new IntPtr(cfgPath0)); Marshal.FreeHGlobal(new IntPtr(gridName0)); } } }
internal static IUnmanagedTarget IgnitionStart(UnmanagedContext ctx, string cfgPath, string gridName, bool clientMode) { using (var mem = IgniteManager.Memory.Allocate().GetStream()) { mem.WriteBool(clientMode); sbyte *cfgPath0 = IgniteUtils.StringToUtf8Unmanaged(cfgPath); sbyte *gridName0 = IgniteUtils.StringToUtf8Unmanaged(gridName); try { void *res = JNI.IgnitionStart(ctx.NativeContext, cfgPath0, gridName0, InteropFactoryId, mem.SynchronizeOutput()); return(new UnmanagedTarget(ctx, res)); } finally { Marshal.FreeHGlobal(new IntPtr(cfgPath0)); Marshal.FreeHGlobal(new IntPtr(gridName0)); } } }
internal static IUnmanagedTarget Acquire(UnmanagedContext ctx, void *target) { void *target0 = JNI.Acquire(ctx.NativeContext, target); return(new UnmanagedTarget(ctx, target0)); }
/// <summary> /// Constructor. /// </summary> /// <param name="ctx">Context.</param> /// <param name="target">Target.</param> public UnmanagedNonReleaseableTarget(UnmanagedContext ctx, void* target) { _ctx = ctx; _target = target; }
internal static IUnmanagedTarget Acquire(UnmanagedContext ctx, void* target) { void* target0 = JNI.Acquire(ctx.NativeContext, target); return new UnmanagedTarget(ctx, target0); }
/// <summary> /// Constructor. /// </summary> /// <param name="ctx">Context.</param> /// <param name="target">Target.</param> public UnmanagedNonReleaseableTarget(UnmanagedContext ctx, void *target) { _ctx = ctx; _target = target; }