Beispiel #1
0
        /// <summary>
        /// Create JVM.
        /// </summary>
        /// <returns>JVM.</returns>
        private static Jvm CreateJvm(IgniteConfiguration cfg)
        {
            var cp = Classpath.CreateClasspath(cfg);

            var jvmOpts = GetMergedJvmOptions(cfg);

            jvmOpts.Add(cp);

            return(Jvm.GetOrCreate(jvmOpts));
        }
Beispiel #2
0
        /// <summary>
        /// Create JVM.
        /// </summary>
        /// <returns>JVM.</returns>
        private static void *CreateJvm(IgniteConfiguration cfg, UnmanagedCallbacks cbs)
        {
            var ggHome = IgniteHome.Resolve(cfg);

            var cp = Classpath.CreateClasspath(ggHome, cfg, false);

            var jvmOpts = GetMergedJvmOptions(cfg);

            var hasGgHome = !string.IsNullOrWhiteSpace(ggHome);

            var opts = new sbyte *[1 + jvmOpts.Count + (hasGgHome ? 1 : 0)];

            int idx = 0;

            opts[idx++] = IgniteUtils.StringToUtf8Unmanaged(cp);

            if (hasGgHome)
            {
                opts[idx++] = IgniteUtils.StringToUtf8Unmanaged("-DIGNITE_HOME=" + ggHome);
            }

            foreach (string cfgOpt in jvmOpts)
            {
                opts[idx++] = IgniteUtils.StringToUtf8Unmanaged(cfgOpt);
            }

            try
            {
                IntPtr mem = Marshal.AllocHGlobal(opts.Length * 8);

                fixed(sbyte **opts0 = opts)
                {
                    PlatformMemoryUtils.CopyMemory(opts0, mem.ToPointer(), opts.Length * 8);
                }

                try
                {
                    return(UU.CreateContext(mem.ToPointer(), opts.Length, cbs.CallbacksPointer));
                }
                finally
                {
                    Marshal.FreeHGlobal(mem);
                }
            }
            finally
            {
                foreach (sbyte *opt in opts)
                {
                    Marshal.FreeHGlobal((IntPtr)opt);
                }
            }
        }
Beispiel #3
0
        /// <summary>
        /// Create JVM.
        /// </summary>
        /// <returns>JVM.</returns>
        private static Jvm CreateJvm(IgniteConfiguration cfg, ILogger log)
        {
            // Do not bother with classpath when JVM exists.
            var jvm = Jvm.Get(true);

            if (jvm != null)
            {
                return(jvm);
            }

            var cp = Classpath.CreateClasspath(cfg, log: log);

            var jvmOpts = GetMergedJvmOptions(cfg);

            jvmOpts.Add(cp);

            return(Jvm.GetOrCreate(jvmOpts));
        }
Beispiel #4
0
        /// <summary>
        /// Create JVM.
        /// </summary>
        /// <returns>JVM.</returns>
        private static void *CreateJvm(IgniteConfiguration cfg, UnmanagedCallbacks cbs)
        {
            var cp = Classpath.CreateClasspath(cfg);

            var jvmOpts = GetMergedJvmOptions(cfg);

            var opts = new sbyte *[1 + jvmOpts.Count];

            int idx = 0;

            opts[idx++] = IgniteUtils.StringToUtf8Unmanaged(cp);

            foreach (string cfgOpt in jvmOpts)
            {
                opts[idx++] = IgniteUtils.StringToUtf8Unmanaged(cfgOpt);
            }

            try
            {
                IntPtr mem = Marshal.AllocHGlobal(opts.Length * 8);

                fixed(sbyte **opts0 = opts)
                {
                    PlatformMemoryUtils.CopyMemory(opts0, mem.ToPointer(), opts.Length * 8);
                }

                try
                {
                    return(UU.CreateContext(mem.ToPointer(), opts.Length, cbs.CallbacksPointer));
                }
                finally
                {
                    Marshal.FreeHGlobal(mem);
                }
            }
            finally
            {
                foreach (sbyte *opt in opts)
                {
                    Marshal.FreeHGlobal((IntPtr)opt);
                }
            }
        }
Beispiel #5
0
        /// <summary>
        /// Create JVM.
        /// </summary>
        /// <returns>JVM.</returns>
        internal static Jvm CreateJvm(IgniteConfiguration cfg, ILogger log)
        {
            // Do not bother with classpath when JVM exists.
            var jvm = Jvm.Get(true);

            if (jvm != null)
            {
                return(jvm);
            }

            var igniteHome = IgniteHome.Resolve(cfg.IgniteHome, log);
            var cp         = Classpath.CreateClasspath(classPath: cfg.JvmClasspath, igniteHome: igniteHome, log: log);

            var jvmOpts = GetMergedJvmOptions(cfg, igniteHome);

            jvmOpts.Add(cp);

            return(Jvm.GetOrCreate(jvmOpts));
        }
Beispiel #6
0
 /// <summary>
 ///
 /// </summary>
 /// <returns></returns>
 public static string CreateTestClasspath()
 {
     return(Classpath.CreateClasspath(forceTestClasspath: true));
 }
Beispiel #7
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public static string CreateTestClasspath()
        {
            var home = IgniteHome.Resolve();

            return(Classpath.CreateClasspath(null, home, forceTestClasspath: true));
        }