Repository: ignite
Updated Branches:
  refs/heads/ignite-3199-1 48868f515 -> 469be48f2


Fix startup logic


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/12a3c0c3
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/12a3c0c3
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/12a3c0c3

Branch: refs/heads/ignite-3199-1
Commit: 12a3c0c3832a64f44a5469ac4d1c68751db2f6fb
Parents: 48868f5
Author: Pavel Tupitsyn <ptupit...@apache.org>
Authored: Fri Sep 16 12:14:02 2016 +0300
Committer: Pavel Tupitsyn <ptupit...@apache.org>
Committed: Fri Sep 16 12:14:02 2016 +0300

----------------------------------------------------------------------
 .../Apache.Ignite.AspNet/Impl/ConfigUtil.cs     | 32 ++++++++++++++------
 1 file changed, 22 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/12a3c0c3/modules/platforms/dotnet/Apache.Ignite.AspNet/Impl/ConfigUtil.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.AspNet/Impl/ConfigUtil.cs 
b/modules/platforms/dotnet/Apache.Ignite.AspNet/Impl/ConfigUtil.cs
index c381c4c..0351358 100644
--- a/modules/platforms/dotnet/Apache.Ignite.AspNet/Impl/ConfigUtil.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.AspNet/Impl/ConfigUtil.cs
@@ -56,9 +56,7 @@ namespace Apache.Ignite.AspNet.Impl
 
             try
             {
-                var grid = cfgSection != null
-                    ? StartFromApplicationConfiguration(cfgSection)
-                    : Ignition.GetIgnite(gridName);
+                var grid = StartFromApplicationConfiguration(cfgSection, 
gridName);
 
                 grid.Logger.GetLogger(callerType.ToString())
                     .Info("Initializing {0} with cache '{1}'", callerType, 
cacheName);
@@ -78,19 +76,33 @@ namespace Apache.Ignite.AspNet.Impl
         /// <summary>
         /// Starts Ignite from application configuration.
         /// </summary>
-        private static IIgnite StartFromApplicationConfiguration(string 
sectionName)
+        private static IIgnite StartFromApplicationConfiguration(string 
sectionName, string gridName)
         {
-            var section = ConfigurationManager.GetSection(sectionName) as 
IgniteConfigurationSection;
+            IgniteConfiguration config;
 
-            if (section == null)
-                throw new 
ConfigurationErrorsException(string.Format(CultureInfo.InvariantCulture,
-                    "Could not find {0} with name '{1}'", 
typeof(IgniteConfigurationSection).Name, sectionName));
+            if (!string.IsNullOrEmpty(sectionName))
+            {
+                var section = ConfigurationManager.GetSection(sectionName) as 
IgniteConfigurationSection;
+
+                if (section == null)
+                    throw new 
ConfigurationErrorsException(string.Format(CultureInfo.InvariantCulture,
+                        "Could not find {0} with name '{1}'", 
typeof(IgniteConfigurationSection).Name, sectionName));
+
+                config = section.IgniteConfiguration;
+            }
+            else
+                config = new IgniteConfiguration {GridName = gridName};
+
+            // Check if already started.
+            var ignite = Ignition.TryGetIgnite(config.GridName);
 
-            var config = section.IgniteConfiguration;
+            if (ignite != null)
+                return ignite;
 
+            // Start.
             if (string.IsNullOrWhiteSpace(config.IgniteHome))
             {
-                // IgniteHome not set by user: populate from default directory
+                // IgniteHome not set by user: populate from default directory.
                 config = new IgniteConfiguration(config) { IgniteHome = 
IgniteWebUtils.GetWebIgniteHome() };
             }
 

Reply via email to