/// <summary> /// The main entry point for the tool. /// </summary> public static void Run(string[] args) { try { object param = new StopCacheToolParam(); CommandLineArgumentParser.CommandLineParser(ref param, args); cParam = (StopCacheToolParam)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)); string getBindIp = string.Empty; if (m != null) { foreach (string cache in s_cacheId) { try { getBindIp = m.GetBindIP(); Console.WriteLine("\nStopping cache '{0}' on server {1}:{2}.", cache, getBindIp, NCache.Port); m.StopCache(cache); Console.WriteLine("'{0}' successfully stopped on server {1}:{2}.\n", cache, getBindIp, NCache.Port); } catch (Exception e) { Console.Error.WriteLine("Failed to stop '{0}'. Error: {1} ", cache, e.Message); Console.Error.WriteLine(); Console.Error.WriteLine(e.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) { try { object param = new StopCacheToolParam(); CommandLineArgumentParser.CommandLineParser(ref param, args); cParam = (StopCacheToolParam) 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)); string getBindIp = string.Empty; if (m != null) { foreach (string cache in s_cacheId) { try { getBindIp = m.GetBindIP(); Console.WriteLine("\nStopping cache '{0}' on server {1}:{2}.", cache, getBindIp, NCache.Port); m.StopCache(cache); Console.WriteLine("'{0}' successfully stopped on server {1}:{2}.\n", cache, getBindIp, NCache.Port); } catch (Exception e) { Console.Error.WriteLine("Failed to stop '{0}'. Error: {1} ", cache, e.Message); Console.Error.WriteLine(); Console.Error.WriteLine(e.ToString()); } } } } catch (Exception e) { Console.Error.WriteLine("Error : {0}", e.Message); Console.Error.WriteLine(); Console.Error.WriteLine(e.ToString()); } finally { NCache.Dispose(); } }