IGNITE-1696: Added IBM JDK specific path to jvm.dll library search sequence.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/27300974 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/27300974 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/27300974 Branch: refs/heads/ignite-1655 Commit: 27300974bacfc5d8aa927cc082933608dc325bcf Parents: 9879bed Author: Pavel Tupitsyn <[email protected]> Authored: Tue Oct 20 15:58:11 2015 +0300 Committer: thatcoach <[email protected]> Committed: Tue Oct 20 15:58:11 2015 +0300 ---------------------------------------------------------------------- .../Apache.Ignite.Core/Impl/IgniteUtils.cs | 30 +++++--------------- 1 file changed, 7 insertions(+), 23 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/27300974/modules/platforms/dotnet/Apache.Ignite.Core/Impl/IgniteUtils.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/IgniteUtils.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/IgniteUtils.cs index 88ab75f..7588945 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/IgniteUtils.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/IgniteUtils.cs @@ -41,14 +41,8 @@ namespace Apache.Ignite.Core.Impl /** Environment variable: JAVA_HOME. */ private const string EnvJavaHome = "JAVA_HOME"; - /** Directory: jre. */ - private const string DirJre = "jre"; - - /** Directory: bin. */ - private const string DirBin = "bin"; - - /** Directory: server. */ - private const string DirServer = "server"; + /** Lookup paths. */ + private static readonly string[] JvmDllLookupPaths = {@"jre\bin\server", @"jre\bin\default"}; /** File: jvm.dll. */ private const string FileJvmDll = "jvm.dll"; @@ -78,12 +72,9 @@ namespace Apache.Ignite.Core.Impl /// Gets thread local random. /// </summary> /// <returns>Thread local random.</returns> - public static Random ThreadLocalRandom() + private static Random ThreadLocalRandom() { - if (_rnd == null) - _rnd = new Random(); - - return _rnd; + return _rnd ?? (_rnd = new Random()); } /// <summary> @@ -260,16 +251,9 @@ namespace Apache.Ignite.Core.Impl var javaHomeDir = Environment.GetEnvironmentVariable(EnvJavaHome); if (!string.IsNullOrEmpty(javaHomeDir)) - yield return - new KeyValuePair<string, string>(EnvJavaHome, GetJvmDllPath(Path.Combine(javaHomeDir, DirJre))); - } - - /// <summary> - /// Gets the JVM DLL path from JRE dir. - /// </summary> - private static string GetJvmDllPath(string jreDir) - { - return Path.Combine(jreDir, DirBin, DirServer, FileJvmDll); + foreach (var path in JvmDllLookupPaths) + yield return + new KeyValuePair<string, string>(EnvJavaHome, Path.Combine(javaHomeDir, path, FileJvmDll)); } /// <summary>
