/// <summary> /// The main entry point for the tool. /// </summary> static public void Run(string[] args) { NCache = new NCacheRPCService(""); string cacheIp = string.Empty; try { object param = new StartCacheToolParam(); CommandLineArgumentParser.CommandLineParser(ref param, args); cParam = (StartCacheToolParam)param; if (cParam.IsUsage) { AssemblyUsage.PrintLogo(cParam.IsLogo); AssemblyUsage.PrintUsage(); return; } if (!ApplyParameters(args)) { return; } ICacheServer m = NCache.GetCacheServer(new TimeSpan(0, 0, 0, 30)); CacheServerConfig config = null; cacheIp = m.GetClusterIP(); if (m != null) { foreach (string cache in s_cacheId) { try { config = m.GetCacheConfiguration((string)cache); if (config != null && config.InProc) { throw new Exception("InProc caches cannot be started explicitly."); } Console.WriteLine("\nStarting cache '{0}' on server {1}:{2}.", cache, cacheIp, NCache.Port); m.StartCache(cache, string.Empty); Console.WriteLine("'{0}' successfully started on server {1}:{2}.\n", cache, cacheIp, NCache.Port); } catch (Exception e) { Console.Error.WriteLine("Failed to start '{0}' on server {1}.", cache, cacheIp); Console.Error.WriteLine(); Console.Error.WriteLine(e.ToString() + "\n"); } } } } catch (ManagementException ex) { Console.Error.WriteLine("Error : {0}", "NCache service could not be contacted on server."); Console.Error.WriteLine(); Console.Error.WriteLine(ex.ToString()); } catch (Exception e) { Console.Error.WriteLine("Error : {0}", e.Message); Console.Error.WriteLine(); Console.Error.WriteLine(e.ToString()); } finally { NCache.Dispose(); } }
/// <summary> /// The main entry point for the tool. /// </summary> public static void Run(string[] args) { NCache = new NCacheRPCService(""); string cacheIp = string.Empty; try { object param = new StartCacheToolParam(); CommandLineArgumentParser.CommandLineParser(ref param, args); cParam = (StartCacheToolParam)param; if (cParam.IsUsage) { AssemblyUsage.PrintLogo(cParam.IsLogo); AssemblyUsage.PrintUsage(); return; } if (!ApplyParameters(args)) return; ICacheServer m = NCache.GetCacheServer(new TimeSpan(0, 0, 0, 30)); CacheServerConfig config = null; cacheIp = m.GetClusterIP(); if (m != null) { foreach (string cache in s_cacheId) { try { config = m.GetCacheConfiguration((string)cache); if (config != null && config.InProc) { throw new Exception("InProc caches cannot be started explicitly."); } Console.WriteLine("\nStarting cache '{0}' on server {1}:{2}.", cache, cacheIp, NCache.Port); m.StartCache(cache, string.Empty); Console.WriteLine("'{0}' successfully started on server {1}:{2}.\n", cache, cacheIp, NCache.Port); } catch (Exception e) { Console.Error.WriteLine("Failed to start '{0}' on server {1}.", cache, cacheIp); Console.Error.WriteLine(); Console.Error.WriteLine(e.ToString() + "\n"); } } } } catch (ManagementException ex) { Console.Error.WriteLine("Error : {0}", "NCache service could not be contacted on server."); Console.Error.WriteLine(); Console.Error.WriteLine(ex.ToString()); } catch (Exception e) { Console.Error.WriteLine("Error : {0}", e.Message); Console.Error.WriteLine(); Console.Error.WriteLine(e.ToString()); } finally { NCache.Dispose(); } }