/// <summary> /// initilaise /// </summary> protected virtual void Initialize() { CacheService cacheService = null; if (RuntimeContext.CurrentContext == RtContextValue.JVCACHE) { cacheService = new JvCacheRPCService(_address, _port); cacheService.OnGetSecurityCredentials += new EventHandler <CredentialsEventArgs>(OnGetSecurityCredentials); } else { cacheService = new NCacheRPCService(_address, _port); } try { _server = cacheService.GetCacheServer(TimeSpan.FromSeconds(7)); } catch (SshAuthenticationException) { throw new Exception("Could not authenticate on server. Incorrect Username or Password."); } catch (Exception) { throw; } finally { cacheService.Dispose(); } }
public CacheServerConfig GetServerConfiguration(string server, int port, string cacheId) { CacheServerConfig serverConfig = null; if (port != -1) { NCache.Port = port; } if (port == -1) { NCache.Port = NCache.UseTcp ? CacheConfigManager.NCacheTcpPort: CacheConfigManager.HttpPort; } if (server != null && server != string.Empty) { NCache.ServerName = server; } cacheServer = NCache.GetCacheServer(new TimeSpan(0, 0, 0, 30)); if (cacheServer != null) { serverConfig = cacheServer.GetCacheConfiguration(cacheId); if (serverConfig == null) { throw new Exception("Specified cache is not registered on given server."); } } return(serverConfig); }
public bool IsRunningCache(string server, int port, string cacheId) { ArrayList runningCaches = new ArrayList(); bool isRunning = false; if (port != -1) { NCache.Port = port; } if (port == -1) { NCache.Port = NCache.UseTcp ? CacheConfigManager.NCacheTcpPort : CacheConfigManager.HttpPort; } if (server != null && server != string.Empty) { NCache.ServerName = server; } cacheServer = NCache.GetCacheServer(new TimeSpan(0, 0, 0, 30)); if (cacheServer != null) { isRunning = cacheServer.IsRunning(cacheId); } return(isRunning); }
public static void StopCache(string cacheId) { ICacheServer cs = null; CacheService cacheService = new NCacheRPCService(null); CacheServerConfig config = null; try { cacheService.ServerName = Environment.MachineName; cs = cacheService.GetCacheServer(new TimeSpan(0, 0, 0, 30)); if (cs != null) { config = cs.GetCacheConfiguration(cacheId); if (!config.InProc) { cs.StopCache(cacheId); } else { throw new ManagementException("Inproc caches cannot be stopped explicitly."); } } } finally { if (cs != null) { cs.Dispose(); } cacheService.Dispose(); } }
private NodeStatus GetCacheStatistics(NCacheRPCService nCacheRPCService) { ICacheServer cacheServer = nCacheRPCService.GetCacheServer(new TimeSpan(0, 0, 0, 30)); NodeStatus nodeInfo = new NodeStatus(); nodeInfo.isRegistered = true; if (cacheServer.GetCacheConfiguration(CacheName) == null) { nodeInfo.isRegistered = false; return(nodeInfo); } var config = cacheServer.GetCacheConfiguration(CacheName); if (config.CacheType.Contains("local")) { nodeInfo.Topology = Topology.LOCAL; } else { if (config.Cluster.Topology.Contains("partitioned-replicas")) { nodeInfo.Topology = Topology.POR; } else { nodeInfo.Topology = Topology.OTHER; } } return(nodeInfo); }
public static void StopCache(string cacheId, string serverName, bool isGracefulShutdown) { ICacheServer cs = null; CacheService cacheService = new NCacheRPCService(null); try { cacheService.ServerName = serverName; cs = cacheService.GetCacheServer(new TimeSpan(0, 0, 0, 30)); if (cs != null) { cs.StopCache(cacheId); } } catch (Exception ex) { if (cs != null) { cs.Dispose(); cs = null; } throw new ManagementException(ex.Message); } finally { if (cs != null) { cs.Dispose(); } cacheService.Dispose(); } }
public LoginUseCase(IUserRepository userRepository, ICommon common, ICacheServer cacheServer, IEventBus eventBus) { _common = common; _userRepository = userRepository; _cacheServer = cacheServer; _eventBus = eventBus; }
public static void StartCache(string cacheId) { CacheService cacheService = new NCacheRPCService(null); ICacheServer cs = null; try { cacheService.ServerName = Environment.MachineName; cs = cacheService.GetCacheServer(new TimeSpan(0, 0, 0, 30)); if (cs != null) { cs.StartCache(cacheId); } } catch (Exception ex) { throw new ManagementException(ex.Message); } finally { if (cs != null) { cs.Dispose(); } cacheService.Dispose(); } }
private bool IsUnderStateTransfer(string cacheId, CacheServerConfig settings) { bool isUnderStateTransfer = false; if (settings != null && settings.Cluster != null && settings.Cluster.Nodes != null) { foreach (var Node in settings.Cluster.Nodes) { ICacheServer cacheserver = null; try { //Try connecting to each node NCacheRPCService nCacheRPCService = new NCacheRPCService(Node.Key.NodeName); cacheserver = nCacheRPCService.GetCacheServer(new TimeSpan(0, 0, 0, 30)); isUnderStateTransfer = cacheserver.IsUnderStateTransfer(cacheId); if (isUnderStateTransfer) { return(isUnderStateTransfer); } } catch { } } } return(isUnderStateTransfer); }
public void RegisterCache(Alachisoft.NCache.Config.NewDom.CacheServerConfig serverConfig, int port, string cacheId, bool isHotApply, bool isOverwrite, string server) { if (port != -1) { NCache.Port = port; } if (port == -1) { NCache.Port = NCache.UseTcp ? CacheConfigManager.NCacheTcpPort : CacheConfigManager.HttpPort; } if (server != null && server != string.Empty) { NCache.ServerName = server; } cacheServer = NCache.GetCacheServer(new TimeSpan(0, 0, 0, 30)); if (cacheServer != null) { if (serverConfig.CacheSettings.CacheType == "clustered-cache") { foreach (Address node in serverConfig.CacheDeployment.Servers.GetAllConfiguredNodes()) { NCache.ServerName = node.IpAddress.ToString(); try { cacheServer = NCache.GetCacheServer(new TimeSpan(0, 0, 0, 30)); cacheServer.RegisterCache(cacheId, serverConfig, "", isOverwrite, isHotApply); } catch (Exception ex) { Console.Error.WriteLine("Failed to Configure Backing Source on '{0}'. ", NCache.ServerName); Console.Error.WriteLine("Error Detail: '{0}'. ", ex.Message); } finally { cacheServer.Dispose(); } } } else { try { cacheServer.RegisterCache(cacheId, serverConfig, "", isOverwrite, isHotApply); } catch (Exception ex) { Console.Error.WriteLine("Failed to Configure Backing Source on '{0}'. ", NCache.ServerName); Console.Error.WriteLine("Error Detail: '{0}'. ", ex.Message); } finally { cacheServer.Dispose(); } } } }
public static void StartCache(string cacheId, string serverName, int port, string userId, string password) { ICacheServer cs = null; CacheService cacheService = new NCacheRPCService(null); CacheServerConfig config = null; try { cacheService.ServerName = serverName; cacheService.Port = port; cs = cacheService.GetCacheServer(new TimeSpan(0, 0, 0, 30)); if (cs != null) { config = cs.GetCacheConfiguration(cacheId); if (config != null) { if (!config.InProc) { cs.StartCache(cacheId); } } else { throw new ManagementException("Unable to Start Cache. Specified cache is not registered."); } } } catch (SecurityException ex) { if (cs != null) { cs.Dispose(); cs = null; } throw ex; } catch (Exception ex) { if (cs != null) { cs.Dispose(); cs = null; } throw new ManagementException(ex.Message); } finally { if (cs != null) { cs.Dispose(); } cacheService.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(); } }
public void VerifyLicense() { ToolsUtil.PrintLogo(OutputProvider, printLogo, TOOLNAME); string ipAddress = "this machine"; ServerLicenseInfo serverLicenseInfo; try { if (string.IsNullOrEmpty(Server)) { serverLicenseInfo = new ServerLicenseInfo(); } else { NCache = new NCacheRPCService(""); NCache.Port = Port; NCache.ServerName = Server; ipAddress = Server; ICacheServer nCacheServer = null; nCacheServer = NCache.GetCacheServer(new TimeSpan(0, 0, 0, 30)); if (nCacheServer != null) { serverLicenseInfo = nCacheServer.GetServerLicenseInfo(); } else { serverLicenseInfo = new ServerLicenseInfo(); } } OutputProvider.WriteLine("This product is registered to "); OutputProvider.WriteLine("User: "******"Email: " + serverLicenseInfo._email); OutputProvider.WriteLine("Company: " + serverLicenseInfo._companyName); OutputProvider.WriteLine("Edition: " + "NCache OpenSource "); if (LicenseManager.LicenseMode(null) == LicenseManager.LicenseType.UnRegistered) { OutputProvider.WriteLine("\nThe machine does not have a valid registration information. Please register this machine with a FREE installation key.You can get free installation key from http://www.alachisoft.com/activate/RequestKey.php?Edition=NC-OSS-50-4x&Version=5.0&Source=Register-NCache"); OutputProvider.WriteLine("\nIf you are using this machine as NCache client, then you don't need to register NCache on this machine. Only cache server machines are required to be registered"); } else { OutputProvider.WriteLine(""); OutputProvider.WriteLine("Licensed to use FREE of cost. Use As-is without support."); } } catch (Exception ex) { OutputProvider.WriteLine(ex.ToString()); return; } OutputProvider.WriteLine("\n"); }
void StartCacheOnServer() { OutputProvider.WriteLine("Licensed to use FREE of cost. Use As-is without support.\n"); string cacheIp = string.Empty; try { ICacheServer cacheServer = NCache.GetCacheServer(new TimeSpan(0, 0, 0, 30)); CacheServerConfig config = null; if (cacheServer != null) { cacheIp = cacheServer.GetClusterIP(); foreach (string cache in CachesList) { try { config = cacheServer.GetCacheConfiguration(cache); if (config != null && config.InProc) { throw new Exception("InProc caches cannot be started explicitly."); } OutputProvider.WriteLine("Starting cache '{0}' on server {1}:{2}.", cache, cacheIp, NCache.Port); cacheServer.StartCache(cache, _partId); OutputProvider.WriteLine("'{0}' successfully started on server {1}:{2}.\n", cache, cacheIp, NCache.Port); } catch (Exception e) { OutputProvider.WriteErrorLine("Failed to start '{0}' on server {1}.", cache, cacheIp); OutputProvider.WriteErrorLine(e.ToString() + "\n"); } } } } catch (ManagementException ex) { OutputProvider.WriteErrorLine("Error : {0}", "NCache service could not be contacted on server"); OutputProvider.WriteErrorLine(ex.ToString()); } catch (Exception e) { OutputProvider.WriteErrorLine("Error : {0}", e.Message); OutputProvider.WriteErrorLine(e.ToString()); } finally { NCache.Dispose(); } }
/// <summary> /// Returns the instance of Cache manager running on the node, starts the service /// if not running. /// </summary> /// <returns></returns> public virtual ICacheServer GetCacheServer(TimeSpan timeout) { ICacheServer cm = null; try { // Try to connect to cache manager first, saves time if the // service is already running. cm = ConnectCacheServer(); } catch (SocketException socketException) { if (socketException.SocketErrorCode == SocketError.TimedOut) //Machine is not accesible my be should down or we cannot reach it so no need to start service { throw new ManagementException(socketException.Message, socketException); } try { // Check and start NCache service and then try again Start(timeout); cm = ConnectCacheServer(); } catch (ManagementException) { throw; } catch (Exception e) { throw new ManagementException(e.Message, e); } } catch (Exception exception) { try { // Check and start NCache service and then try again Start(timeout); cm = ConnectCacheServer(); } catch (ManagementException) { throw; } catch (Exception e) { throw new ManagementException(e.Message, e); } } return(cm); }
public static bool VerifyClusterConfigurations(Alachisoft.NCache.Config.NewDom.CacheServerConfig serverConfig , string cacheName) { if (serverConfig == null) { throw new Exception("Specified cache is not registered on the given server"); } double configVersion = -1; double deploymentVersion = -1; string configId = "dummyconfig"; NCacheRPCService NCache = new NCacheRPCService(""); if (serverConfig.CacheSettings.CacheType == "clustered-cache") { foreach (Address node in serverConfig.CacheDeployment.Servers.GetAllConfiguredNodes()) { NCache.ServerName = node.IpAddress.ToString(); ICacheServer cacheServer = NCache.GetCacheServer(new TimeSpan(0, 0, 0, 30)); ConfigurationVersion config = cacheServer.GetConfigurationVersion(cacheName); if (configId.Equals(configId)) { configId = config.ConfigID; } else if (!configId.Equals(config.ConfigID, StringComparison.InvariantCultureIgnoreCase)) { throw new VersionException("same name cache is already registered on node : " + node.IpAddress, 0); } if (configVersion == -1) { configVersion = config.ConfigVersion; } else if (configVersion != config.ConfigVersion) { throw new VersionException("There is a configuration mismatch for caches : " + cacheName, 0); } if (deploymentVersion == -1) { deploymentVersion = config.DeploymentVersion; } else if (deploymentVersion != config.DeploymentVersion) { throw new Exception("Deployment version is not same on all nodes"); } cacheServer.Dispose(); } } return(true); }
/// <summary> /// initilaise /// </summary> protected virtual void Initialize() { CacheService cacheService = null; cacheService = new NCacheRPCService(_address, _port); try { _server = cacheService.GetCacheServer(TimeSpan.FromSeconds(7)); } finally { cacheService.Dispose(); } }
/// <summary> /// initilaise /// </summary> protected virtual void Initialize() { CacheService cacheService = null; cacheService = new NCacheRPCService(_address, _port); try { _server = cacheService.GetCacheServer(TimeSpan.FromSeconds(7)); } finally { cacheService.Dispose(); } }
public Dictionary <int, Management.ClientConfiguration.Dom.CacheServer> BringLocalServerToFirstPriority(string localNode, Dictionary <int, Management.ClientConfiguration.Dom.CacheServer> serversPriorityList) { Dictionary <int, Management.ClientConfiguration.Dom.CacheServer> tempList = new Dictionary <int, Management.ClientConfiguration.Dom.CacheServer>(); int localServerPriority = 0; bool localServerFound = false; NCache.ServerName = localNode; ICacheServer sw = NCache.GetCacheServer(new TimeSpan(0, 0, 0, 30)); string nodeName = localNode; Hashtable temp = sw.GetNodeInfo().Map; string server = temp[Alachisoft.NCache.Management.CacheServer.Channel.SocketServer] as string; IPAddress serverAddress = null; if (IPAddress.TryParse(server, out serverAddress)) { nodeName = server; } foreach (KeyValuePair <int, Management.ClientConfiguration.Dom.CacheServer> pair in serversPriorityList) { string serverName = pair.Value.ServerName.ToLower(); if (serverName.CompareTo(nodeName.ToLower()) == 0) { localServerFound = true; localServerPriority = pair.Key; break; } } if (localServerFound) { tempList.Add(0, serversPriorityList[localServerPriority]); int priority = 1; foreach (KeyValuePair <int, Management.ClientConfiguration.Dom.CacheServer> pair in serversPriorityList) { if (pair.Key != localServerPriority) { tempList.Add(priority++, pair.Value); } } serversPriorityList = tempList; } return(serversPriorityList); }
/// <summary> /// Returns the instance of Cache manager running on the node, starts the service /// if not running. /// </summary> /// <returns></returns> public virtual ICacheServer GetCacheServer(TimeSpan timeout) { ICacheServer cm = null; try { cm = ConnectCacheServer(); } catch (SocketException socketException) { if (socketException.SocketErrorCode == SocketError.TimedOut) //Machine is not accesible my be should down or we cannot reach it so no need to start service { throw new ManagementException(socketException.Message, socketException); } try { Start(timeout); cm = ConnectCacheServer(); } catch (ManagementException) { throw; } catch (Exception e) { throw new ManagementException(e.Message, e); } } catch (Exception exception) { try { Start(timeout); cm = ConnectCacheServer(); } catch (ManagementException) { throw; } catch (Exception e) { throw new ManagementException(e.Message, e); } } return(cm); }
public void VerifyLicense() { ToolsUtil.PrintLogo(OutputProvider, printLogo, TOOLNAME); string ipAddress = "this machine"; ServerLicenseInfo serverLicenseInfo; try { if (string.IsNullOrEmpty(Server)) { serverLicenseInfo = new ServerLicenseInfo(); } else { NCache = new NCacheRPCService(""); NCache.Port = Port; NCache.ServerName = Server; ipAddress = Server; ICacheServer nCacheServer = null; nCacheServer = NCache.GetCacheServer(new TimeSpan(0, 0, 0, 30)); if (nCacheServer != null) { serverLicenseInfo = nCacheServer.GetServerLicenseInfo(); } else { serverLicenseInfo = new ServerLicenseInfo(); } } OutputProvider.WriteLine("This product is registered to "); OutputProvider.WriteLine("User: "******"Email: " + serverLicenseInfo._email); OutputProvider.WriteLine("Company: " + serverLicenseInfo._companyName); OutputProvider.WriteLine("Edition: " + "NCache OpenSource "); OutputProvider.WriteLine(""); OutputProvider.WriteLine("Licensed to use FREE of cost. Use As-is without support."); } catch (Exception ex) { OutputProvider.WriteLine(ex.ToString()); return; } OutputProvider.WriteLine("\n"); }
public static void StopCache(string cacheId, string serverName, int port, string userId, string password) { ICacheServer cs = null; CacheService cacheService = new NCacheRPCService(null); try { cacheService.ServerName = serverName; cacheService.Port = port; cs = cacheService.GetCacheServer(new TimeSpan(0, 0, 0, 30)); if (cs != null) { cs.StopCache(cacheId); } } catch (SecurityException ex) { if (cs != null) { cs.Dispose(); cs = null; } throw ex; } catch (Exception ex) { if (cs != null) { cs.Dispose(); cs = null; } throw new ManagementException(ex.Message); } finally { if (cs != null) { cs.Dispose(); } cacheService.Dispose(); } }
private static void UpdateServerMappings(MappingConfiguration.Dom.MappingConfiguration mappingConfiguration, string[] nodes) { if (nodes != null && mappingConfiguration != null) { foreach (string node in nodes) { try { NCacheRPCService NCache = new NCacheRPCService(node); ICacheServer cacheServer = NCache.GetCacheServer(new TimeSpan(0, 0, 0, 30)); cacheServer.UpdateServerMappingConfig(mappingConfiguration); cacheServer.Dispose(); } catch (Exception ex) { } } } }
/// <summary> /// Initializes the object with default values. /// </summary> //public Subscription(Cache cache, Server server, SubscriptionState state) zgodnie z kodem dostarczonym z NETApi2 public Subscription(ICacheServer cache, Server server, SubscriptionState state) { if (server == null) { throw new ArgumentNullException("server"); } if (state == null) { throw new ArgumentNullException("state"); } m_cache = cache; m_server = server; m_state = new SubscriptionState(); m_state.Active = false; // set the initial state. ModifyState((int)StateMask.All, state); }
public Dictionary <int, Management.ClientConfiguration.Dom.CacheServer> GetPrioritizedServerListForClient(string clientNode, string clusterId, ArrayList _nodeList) { int priority = 0; string ClientServerName = ""; Dictionary <int, Management.ClientConfiguration.Dom.CacheServer> serversPriorityList = new Dictionary <int, Management.ClientConfiguration.Dom.CacheServer>(); foreach (ServerNode serverNode in _nodeList) { Management.ClientConfiguration.Dom.CacheServer server = new Management.ClientConfiguration.Dom.CacheServer(); try { NCache.ServerName = serverNode.IP; ICacheServer _cacheServer = NCache.GetCacheServer(new TimeSpan(0, 0, 0, 30)); Hashtable bindedIps = _cacheServer.BindedIp().Map; if (bindedIps.Contains(Alachisoft.NCache.Management.Channel.SocketServer)) { ClientServerName = bindedIps[Alachisoft.NCache.Management.Channel.SocketServer].ToString(); } if (!string.IsNullOrEmpty(ClientServerName)) { server.ServerName = ClientServerName; } else { server.ServerName = serverNode.IP; } } catch (Exception ex) { ClientServerName = serverNode.IP; server.ServerName = serverNode.IP; } server.Priority = priority; serversPriorityList[priority++] = server; } serversPriorityList = BringLocalServerToFirstPriority(clientNode, serversPriorityList); return(serversPriorityList); }
private static MappingConfiguration.Dom.MappingConfiguration GetServerMappings(string[] nodes) { if (nodes != null) { List <Mapping> managementIPMapping = new List <Mapping>(); List <Mapping> clientIPMapping = new List <Mapping>(); foreach (string node in nodes) { try { NCacheRPCService NCache = new NCacheRPCService(node); ICacheServer cacheServer = NCache.GetCacheServer(new TimeSpan(0, 0, 0, 30)); Hashtable serverIPMapping = cacheServer.GetServerMappingForConfig(); if (serverIPMapping.Contains("management-ip-mapping")) { managementIPMapping.Add((Mapping)serverIPMapping["management-ip-mapping"]); } if (serverIPMapping.Contains("client-ip-mapping")) { clientIPMapping.Add((Mapping)serverIPMapping["client-ip-mapping"]); } cacheServer.Dispose(); } catch (Exception ex) { } } if (managementIPMapping.Count == 0 && clientIPMapping.Count == 0) { return(null); } MappingConfiguration.Dom.MappingConfiguration mappingConfiguration = new MappingConfiguration.Dom.MappingConfiguration(); mappingConfiguration.ManagementIPMapping = new ServerMapping(managementIPMapping.ToArray()); mappingConfiguration.ClientIPMapping = new ServerMapping(clientIPMapping.ToArray()); return(mappingConfiguration); } return(null); }
/// <summary> /// Initializes the object with its item id and device. /// </summary> //public SubscriptionItem(string itemID, Cache cache)//zgodnie z kodem dostarczonym z serwerem i NETApi2 public SubscriptionItem(string itemID, ICacheServer cache) { if (itemID == null) { throw new ArgumentNullException("itemID"); } if (cache == null) { throw new ArgumentNullException("cache"); } m_itemID = itemID; m_cache = cache; m_euType = (euType)m_cache.ReadProperty(m_itemID, Property.EUTYPE); if (m_euType == euType.analog) { m_maxValue = (double)m_cache.ReadProperty(m_itemID, Property.HIGHEU); m_minValue = (double)m_cache.ReadProperty(m_itemID, Property.LOWEU); } }
public bool IsRunningCaches(string server, int port, string userId, string password) { ArrayList runningCaches = new ArrayList(); bool isRunning = false; if (port != -1) { NCache.Port = port; } if (port == -1) { NCache.Port = NCache.UseTcp ? CacheConfigManager.NCacheTcpPort : CacheConfigManager.HttpPort; } if (server != null && server != string.Empty) { NCache.ServerName = server; } cacheServer = NCache.GetCacheServer(new TimeSpan(0, 0, 0, 30)); if (cacheServer != null) { runningCaches = cacheServer.GetRunningCaches(); } if (runningCaches == null || runningCaches.Count == 0) { isRunning = false; } else { isRunning = true; } return(isRunning); }
public static void ConveyCommandToAllRunningCacheHost(ConfiguredCacheInfo[] cacheHostprocesses, string Action, string server, IOutputConsole OutputProvider) { foreach (ConfiguredCacheInfo cacheHost in cacheHostprocesses) { NCacheRPCService nCache = new NCacheRPCService(""); nCache.Port = cacheHost.ManagementPort; nCache.ServerName = server; if (nCache.Port > 0) { ICacheServer hostService = nCache.GetCacheServer(new TimeSpan(0, 0, 0, 30)); if (Action.ToLower().Equals("start")) { OutputProvider.WriteLine("Starting monitoring on server {0}:{1}.", nCache.ServerName, nCache.Port); hostService.StartMonitoringActivity(); } else if (Action.ToLower().Equals("stop")) { OutputProvider.WriteLine("Stop monitoring on server {0}:{1}.", nCache.ServerName, nCache.Port); hostService.StopMonitoringActivity(); } hostService.PublishActivity(); } } }
/// <summary> /// The main entry point for the tool. /// </summary>ju public static void Run(string[] args) { System.Reflection.Assembly asm = null; Alachisoft.NCache.Config.Dom.Class[] queryClasses = null; string failedNodes = string.Empty; bool sucessful = false; string serverName = string.Empty; try { object param = new RemoveQueryIndexParam(); CommandLineArgumentParser.CommandLineParser(ref param, args); cParam = (RemoveQueryIndexParam)param; if (cParam.IsUsage) { AssemblyUsage.PrintLogo(cParam.IsLogo); AssemblyUsage.PrintUsage(); return; } if (!ValidateParameters()) return; if (cParam.Port == -1) NCache.Port = NCache.UseTcp ? CacheConfigManager.NCacheTcpPort : CacheConfigManager.HttpPort; if (cParam.Server != null && cParam.Server != string.Empty) { NCache.ServerName = cParam.Server; } if (cParam.Port != -1) { NCache.Port = cParam.Port; } cacheServer = NCache.GetCacheServer(new TimeSpan(0, 0, 0, 30)); if (cacheServer != null) { Alachisoft.NCache.Config.NewDom.CacheServerConfig serverConfig = cacheServer.GetNewConfiguration(cParam.CacheId); serverName = cacheServer.GetClusterIP(); if (cacheServer.IsRunning(cParam.CacheId)) throw new Exception(cParam.CacheId + " is Running on " + serverName + "Stop the cache first."); if (serverConfig == null) throw new Exception("Specified cache is not registered on given server."); Console.WriteLine("Removing query indexes on node '{0}' from cache '{1}'.", serverName, cParam.CacheId); if (serverConfig.CacheSettings.QueryIndices != null) { if (serverConfig.CacheSettings.QueryIndices.Classes != null) { queryClasses = serverConfig.CacheSettings.QueryIndices.Classes; } else return; if (queryClasses != null) { serverConfig.CacheSettings.QueryIndices.Classes = GetSourceClass(GetClass(queryClasses)); if (serverConfig.CacheSettings.QueryIndices.Classes != null) { for (int i = 0; i < serverConfig.CacheSettings.QueryIndices.Classes.Length; i++) { if (serverConfig.CacheSettings.QueryIndices.Classes[i].AttributesTable.Count < 1) serverConfig.CacheSettings.QueryIndices.Classes[i] = null; } bool NoClasses = true; foreach (Class cls in serverConfig.CacheSettings.QueryIndices.Classes) { if (cls != null) { NoClasses = false; break; } } if (NoClasses) serverConfig.CacheSettings.QueryIndices = null; } else { } } } else { throw new Exception("No such Query Index class found. "); return; } if (serverConfig.CacheSettings.CacheType == "clustered-cache") { foreach (Address node in serverConfig.CacheDeployment.Servers.GetAllConfiguredNodes()) { NCache.ServerName = node.IpAddress.ToString(); try { cacheServer = NCache.GetCacheServer(new TimeSpan(0, 0, 0, 30)); if (cacheServer.IsRunning(cParam.CacheId)) throw new Exception(cParam.CacheId + " is Running on " + serverName + "Stop the cache first."); cacheServer.RegisterCache(cParam.CacheId, serverConfig, "", true, cParam.IsHotApply); } catch (Exception ex) { Console.Error.WriteLine("Error Detail: '{0}'. ", ex.Message); failedNodes = failedNodes + "/n" + node.IpAddress.ToString(); LogEvent(ex.Message); sucessful = false; } finally { cacheServer.Dispose(); } } } else { try { cacheServer.RegisterCache(cParam.CacheId, serverConfig, "", true, cParam.IsHotApply); } catch (Exception ex) { Console.Error.WriteLine("Error Detail: '{0}'. ", ex.Message); LogEvent(ex.Message); sucessful = false; } finally { cacheServer.Dispose(); } } } sucessful = true; } catch (Exception e) { Console.Error.WriteLine("Failed to Remove Query Index on node '{0}'. ", serverName); Console.Error.WriteLine("Error : {0}", e.Message); LogEvent(e.Message); sucessful = false; } finally { NCache.Dispose(); if (sucessful && !cParam.IsUsage) { Console.WriteLine("Query indexes successfully removed."); } } }
/// <summary> /// The main entry point for the tool. /// </summary>ju public static void Run(string[] args) { bool successful = true; System.Reflection.Assembly asm = null; Alachisoft.NCache.Config.Dom.Class[] queryClasses=null; string failedNodes = string.Empty; string serverName = string.Empty; try { object param = new ConfigureQueryIndexParam(); CommandLineArgumentParser.CommandLineParser(ref param, args); cParam = (ConfigureQueryIndexParam)param; if (cParam.IsUsage) { AssemblyUsage.PrintLogo(cParam.IsLogo); AssemblyUsage.PrintUsage(); return; } if (!ValidateParameters()) { successful = false; return; } if (cParam.Port == -1) NCache.Port = NCache.UseTcp ? CacheConfigManager.NCacheTcpPort : CacheConfigManager.HttpPort; if (cParam.Server != null && cParam.Server != string.Empty) { NCache.ServerName = cParam.Server; } if (cParam.Port != -1) { NCache.Port = cParam.Port; } cacheServer = NCache.GetCacheServer(new TimeSpan(0, 0, 0, 30)); string extension = ".dll"; if (cacheServer != null) { serverName = cacheServer.GetClusterIP(); if (cacheServer.IsRunning(cParam.CacheId)) throw new Exception(cParam.CacheId + " is Running on " + serverName + "\nStop the cache first and try again."); Alachisoft.NCache.Config.NewDom.CacheServerConfig serverConfig = cacheServer.GetNewConfiguration(cParam.CacheId); if (serverConfig == null) throw new Exception("Specified cache is not registered on the given server."); try { asm = System.Reflection.Assembly.LoadFrom(cParam.AsmPath); extension = Path.GetExtension(asm.FullName); } catch (Exception e) { string message = string.Format("Could not load assembly \"" + cParam.AsmPath + "\". {0}", e.Message); Console.Error.WriteLine("Error : {0}", message); LogEvent(e.Message); successful = false; return; } if (asm == null) throw new Exception("Could not load specified Assembly"); System.Type type = asm.GetType(cParam.Class, true); if (serverConfig.CacheSettings.QueryIndices == null) { serverConfig.CacheSettings.QueryIndices = new Alachisoft.NCache.Config.Dom.QueryIndex(); serverConfig.CacheSettings.QueryIndices.Classes = queryClasses; } queryClasses = serverConfig.CacheSettings.QueryIndices.Classes; serverConfig.CacheSettings.QueryIndices.Classes = GetSourceClass(GetClass(queryClasses, asm)); if (serverConfig.CacheSettings.CacheType == "clustered-cache") { foreach (Address node in serverConfig.CacheDeployment.Servers.GetAllConfiguredNodes()) { NCache.ServerName = node.IpAddress.ToString(); try { cacheServer = NCache.GetCacheServer(new TimeSpan(0, 0, 0, 30)); if (cacheServer.IsRunning(cParam.CacheId)) throw new Exception(cParam.CacheId + " is Running on " + serverName + "\nStop the cache first."); Console.WriteLine("Adding query indexes on node '{0}' to cache '{1}'.", serverName, cParam.CacheId); cacheServer.RegisterCache(cParam.CacheId, serverConfig, "", true, cParam.IsHotApply); } catch (Exception ex) { Console.Error.WriteLine("Failed to Add Query Index on '{0}'. ", serverName); Console.Error.WriteLine("Error Detail: '{0}'. ", ex.Message); failedNodes = failedNodes + "/n" + node.IpAddress.ToString(); LogEvent(ex.Message); successful = false; } finally { cacheServer.Dispose(); } } } else { try { Console.WriteLine("Adding query indexes on node '{0}' to cache '{1}'.", serverName, cParam.CacheId); cacheServer.RegisterCache(cParam.CacheId, serverConfig, "", true, cParam.IsHotApply); } catch (Exception ex) { Console.Error.WriteLine("Failed to Add Query Index on '{0}'. ", NCache.ServerName); Console.Error.WriteLine("Error Detail: '{0}'. ", ex.Message); LogEvent(ex.Message); successful = false; } finally { cacheServer.Dispose(); } } } } catch (Exception e) { Console.Error.WriteLine("Error : {0}", e.Message); LogEvent(e.Message); successful = false; } finally { NCache.Dispose(); if (successful && !cParam.IsUsage) Console.WriteLine("Query indexes successfully added."); } }
public void ListCaches() { ToolsUtil.PrintLogo(OutputProvider, printLogo, TOOLNAME); OutputProvider.WriteLine("Licensed to use FREE of cost. Use As-is without support.\n"); if (Port != -1) { NCache.Port = Port; } if (Server != null && !Server.Equals("")) { NCache.ServerName = Server; } string getBindIp = string.Empty; try { ICacheServer cacheServer = null; try { cacheServer = NCache.GetCacheServer(new TimeSpan(0, 0, 0, 30)); } catch (Exception e) { OutputProvider.WriteErrorLine("Error: NCache service could not be contacted on server."); return; } getBindIp = cacheServer.GetBindIP(); OutputProvider.WriteLine("Listing registered caches on server {0}:{1}\n", getBindIp, NCache.Port); if (cacheServer != null) { Alachisoft.NCache.Common.Monitoring.ConfiguredCacheInfo[] caches = cacheServer.GetAllConfiguredCaches(); if (caches.Length > 0) { if (!Detail) { OutputProvider.WriteLine("{0,-25} {1,-35} {2,-15}", "Cache-Name", "Topology", "Status(PID)"); OutputProvider.WriteLine("{0,-25} {1,-35} {2,-15}", "----------", "--------", "-----------"); } if (caches.Length > 0) { for (int i = 0; i < caches.Length; i++) { Alachisoft.NCache.Common.Monitoring.ConfiguredCacheInfo cacheInfo = caches[i]; if (!Detail) { PrintCacheInfo(cacheInfo.Topology.ToString(), cacheInfo.CacheId, cacheInfo.IsRunning, cacheInfo.ProcessID); } else { try { PrintDetailedCacheInfo(cacheServer.GetCacheStatistics2(cacheInfo.CacheId), cacheInfo.Topology.ToString(), null, cacheInfo.IsRunning, cacheInfo.CacheId, cacheInfo.CachePropString, cacheInfo.ProcessID.ToString()); } catch (Exception e) { if (e.Message != null && e.Message.Contains("No connection could be made because the target machine actively refused it")) { PrintDetailedCacheInfo(null, cacheInfo.Topology.ToString(), null, false, cacheInfo.CacheId, cacheInfo.CachePropString, "0"); } else { OutputProvider.WriteErrorLine("Error: {0}", e.Message); OutputProvider.WriteErrorLine(e.ToString()); } } } } } } else { OutputProvider.WriteLine("There are no registered caches on {0}", NCache.ServerName); } } } catch (Exception e) { OutputProvider.WriteErrorLine("Error: {0}", e.Message); OutputProvider.WriteErrorLine(e.ToString()); } finally { NCache.Dispose(); } OutputProvider.WriteLine((Detail)?"": Environment.NewLine); }
public CacheServerConfig GetServerConfiguration(string server, int port, string cacheId) { CacheServerConfig serverConfig=null ; if (port != -1) { NCache.Port = port; } if (port==-1) NCache.Port = NCache.UseTcp ? CacheConfigManager.NCacheTcpPort: CacheConfigManager.HttpPort; if (server != null && server != string.Empty) { NCache.ServerName = server; } cacheServer = NCache.GetCacheServer(new TimeSpan(0, 0, 0, 30)); if (cacheServer != null) { serverConfig = cacheServer.GetCacheConfiguration(cacheId); if (serverConfig == null) throw new Exception("Specified cache is not registered on given server."); } return serverConfig; }
public static bool DeployAssembly(string server, int port, string path, string cacheId, string depAsmPath,LogErrors logError ) { List<FileInfo> files = new List<FileInfo>(); // List that will hold the files and subfiles in path string fileName=null; byte[] asmData; string failedNodes = string.Empty; Alachisoft.NCache.Config.NewDom.CacheServerConfig serverConfig = null; try { if (port != -1) { NCache.Port = port; } if (port == -1) NCache.Port = NCache.UseTcp ? CacheConfigManager.NCacheTcpPort : CacheConfigManager.HttpPort; if (server != null || server != string.Empty) { NCache.ServerName = server; } cacheServer = NCache.GetCacheServer(new TimeSpan(0, 0, 0, 30)); if (cacheServer != null) { serverConfig = cacheServer.GetNewConfiguration(cacheId); if (path != null && path != string.Empty) { if (Path.HasExtension(path)) { FileInfo fi = new FileInfo(path); files.Add(fi); } else { DirectoryInfo di = new DirectoryInfo(path); try { foreach (FileInfo f in di.GetFiles("*")) { if (Path.HasExtension(f.FullName)) files.Add(f); } } catch (Exception ex) { logError("Directory " + di.FullName + "could not be accessed!!!!"); return false; // We already got an error trying to access dir so dont try to access it again } } } if (depAsmPath != null && depAsmPath != string.Empty) { if (Path.HasExtension(depAsmPath)) { FileInfo fi = new FileInfo(path); files.Add(fi); } else { DirectoryInfo di = new DirectoryInfo(depAsmPath); try { foreach (FileInfo f in di.GetFiles("*")) { if (Path.HasExtension(f.FullName)) files.Add(f); } } catch (Exception ex) { logError("Directory " + di.FullName + "could not be accessed!!!!"); return false; // We already got an error trying to access dir so dont try to access it again } } } foreach (FileInfo f in files) { try { FileStream fs = new FileStream(f.FullName, FileMode.Open, FileAccess.Read); asmData = new byte[fs.Length]; fs.Read(asmData, 0, asmData.Length); fs.Flush(); fs.Close(); fileName = Path.GetFileName(f.FullName); if (serverConfig.CacheSettings.CacheType == "clustered-cache") { foreach (Address node in serverConfig.CacheDeployment.Servers.GetAllConfiguredNodes()) { NCache.ServerName = node.IpAddress.ToString(); try { cacheServer = NCache.GetCacheServer(new TimeSpan(0, 0, 0, 30)); cacheServer.CopyAssemblies(cacheId, fileName, asmData); } catch (Exception ex) { logError("Failed to Deploy Assembly on "+NCache.ServerName); logError("Error Detail: "+ex.Message); } } } else cacheServer.CopyAssemblies(cacheId,fileName,asmData); } catch (Exception e) { string message = string.Format("Could not deploy assembly \"" + fileName + "\". {0}", e.Message); logError("Error : " + message); return false; } } } } catch (Exception e) { logError("Error : {0}" + e.Message); } finally { NCache.Dispose(); } return true; }
public void RegisterCache(Alachisoft.NCache.Config.NewDom.CacheServerConfig serverConfig, int port, string cacheId, bool isHotApply, bool isOverwrite, string server) { if (port != -1) { NCache.Port = port; } if (port == -1) NCache.Port = NCache.UseTcp ? CacheConfigManager.NCacheTcpPort : CacheConfigManager.HttpPort; if (server != null && server != string.Empty) { NCache.ServerName = server; } cacheServer = NCache.GetCacheServer(new TimeSpan(0, 0, 0, 30)); if (cacheServer != null) { if (serverConfig.CacheSettings.CacheType == "clustered-cache") { foreach (Address node in serverConfig.CacheDeployment.Servers.GetAllConfiguredNodes()) { NCache.ServerName = node.IpAddress.ToString(); try { cacheServer = NCache.GetCacheServer(new TimeSpan(0, 0, 0, 30)); cacheServer.RegisterCache(cacheId, serverConfig, "", isOverwrite, isHotApply); } catch (Exception ex) { Console.Error.WriteLine("Failed to Configure Backing Source on '{0}'. ", NCache.ServerName); Console.Error.WriteLine("Error Detail: '{0}'. ", ex.Message); } finally { cacheServer.Dispose(); } } } else { try { cacheServer.RegisterCache(cacheId, serverConfig, "", isOverwrite, isHotApply); } catch (Exception ex) { Console.Error.WriteLine("Failed to Configure Backing Source on '{0}'. ", NCache.ServerName); Console.Error.WriteLine("Error Detail: '{0}'. ", ex.Message); } finally { cacheServer.Dispose(); } } } }
public bool IsRunningCaches(string server, int port) { ArrayList runningCaches=new ArrayList(); bool isRunning=false; if (port != -1) { NCache.Port = port; } if (port == -1) NCache.Port = NCache.UseTcp ? CacheConfigManager.NCacheTcpPort : CacheConfigManager.HttpPort; if (server != null && server != string.Empty) { NCache.ServerName = server; } cacheServer = NCache.GetCacheServer(new TimeSpan(0, 0, 0, 30)); if (cacheServer != null) { runningCaches = cacheServer.GetRunningCaches(); } if (runningCaches == null || runningCaches.Count == 0) isRunning = false; else isRunning = true; return isRunning; }
public bool IsRunningCache(string server, int port, string cacheId) { ArrayList runningCaches = new ArrayList(); bool isRunning = false; if (port != -1) { NCache.Port = port; } if (port == -1) NCache.Port = NCache.UseTcp ? CacheConfigManager.NCacheTcpPort : CacheConfigManager.HttpPort; if (server != null && server != string.Empty) { NCache.ServerName = server; } cacheServer = NCache.GetCacheServer(new TimeSpan(0, 0, 0, 30)); if (cacheServer != null) { isRunning = cacheServer.IsRunning(cacheId); } return isRunning; }
private void AddLuceneAnalyzer() { if (!ValidateParameters()) { return; } System.Reflection.Assembly asm = null; Alachisoft.NCache.Config.Dom.LuceneDeployment[] prov = null; string failedNodes = string.Empty; string serverName = string.Empty; ICacheServer cacheServer = null; bool successFull = true; try { if (Port != -1) { NCache.Port = Port; } if (Port == -1) { NCache.Port = NCache.UseTcp ? CacheConfigManager.NCacheTcpPort : CacheConfigManager.HttpPort; } if (Server != null && Server != string.Empty) { NCache.ServerName = Server; } try { cacheServer = NCache.GetCacheServer(new TimeSpan(0, 0, 0, 30)); } catch (Exception e) { successFull = false; OutputProvider.WriteErrorLine("Error: NCache service could not be contacted on server."); return; } if (cacheServer != null) { serverName = cacheServer.GetClusterIP(); if (cacheServer.IsRunning(CacheName)) { successFull = false; throw new Exception(CacheName + " is Running on " + cacheServer.GetClusterIP() + "\nStop the cache first and try again."); } Alachisoft.NCache.Config.NewDom.CacheServerConfig serverConfig = cacheServer.GetNewConfiguration(CacheName); if (serverConfig == null) { successFull = false; throw new Exception("Specified cache is not registered on the given server."); } ToolsUtil.VerifyClusterConfigurations(serverConfig, CacheName); try { asm = System.Reflection.Assembly.LoadFrom(AssemblyPath); } catch (Exception e) { successFull = false; string message = string.Format("Could not load assembly \"" + AssemblyPath + "\". {0}", e.Message); OutputProvider.WriteErrorLine("Error: {0}", message); return; } if (asm == null) { successFull = false; throw new Exception("Could not load specified assembly."); } if (serverConfig.CacheSettings.LuceneSettings == null) { serverConfig.CacheSettings.LuceneSettings = new Alachisoft.NCache.Config.Dom.LuceneSettings(); } System.Type type = asm.GetType(Class, true); if (!type.IsSubclassOf(typeof(Analyzer))) { successFull = false; OutputProvider.WriteErrorLine("Error: Specified class does not implement Analyzer."); return; } else { if (serverConfig.CacheSettings.LuceneSettings.Analyzers == null) { serverConfig.CacheSettings.LuceneSettings.Analyzers = new Analyzers(); serverConfig.CacheSettings.LuceneSettings.Analyzers.Providers = prov; } prov = serverConfig.CacheSettings.LuceneSettings.Analyzers.Providers; serverConfig.CacheSettings.LuceneSettings.Analyzers.Providers = GetAnalyzers(GetProvider(prov, asm)); } byte[] userId = null; byte[] paswd = null; if (UserId != string.Empty && Password != string.Empty) { userId = EncryptionUtil.Encrypt(UserId); paswd = EncryptionUtil.Encrypt(Password); } serverConfig.ConfigVersion++; if (serverConfig.CacheSettings.CacheType == "clustered-cache") { foreach (Address node in serverConfig.CacheDeployment.Servers.GetAllConfiguredNodes()) { NCache.ServerName = node.IpAddress.ToString(); try { cacheServer = NCache.GetCacheServer(new TimeSpan(0, 0, 0, 30)); if (cacheServer.IsRunning(CacheName)) { throw new Exception(CacheName + " is Running on " + serverName + "\nStop the cache first and try again."); } OutputProvider.WriteLine("Adding Analyzer on node '{0}' to cache '{1}'.", node.IpAddress, CacheName); cacheServer.RegisterCache(CacheName, serverConfig, "", true, userId, paswd, false); } catch (Exception ex) { OutputProvider.WriteErrorLine("Failed to Lucene Analyzer on node '{0}'. ", serverName); OutputProvider.WriteErrorLine("Error Detail: '{0}'. ", ex.Message); failedNodes = failedNodes + "/n" + node.IpAddress.ToString(); successFull = false; } finally { cacheServer.Dispose(); } } } else { try { OutputProvider.WriteLine("Adding Analyzer on node '{0}' to cache '{1}'.", serverName, CacheName); cacheServer.RegisterCache(CacheName, serverConfig, "", true, userId, paswd, false); } catch (Exception ex) { OutputProvider.WriteErrorLine("Failed to Lucene Analyzer on node '{0}'. ", serverName); OutputProvider.WriteErrorLine("Error Detail: '{0}'. ", ex.Message); successFull = false; } finally { NCache.Dispose(); } } } } catch (Exception e) { successFull = false; OutputProvider.WriteErrorLine("Failed to Lucene Analyzer on node '{0}'. ", NCache.ServerName); OutputProvider.WriteErrorLine("Error : {0}", e.Message); } finally { NCache.Dispose(); if (successFull && !IsUsage) { OutputProvider.WriteLine("Analyzer successfully added"); } } }
public static void Run(string[] args) { try { object param = new RemoveCacheParam(); CommandLineArgumentParser.CommandLineParser(ref param, args); cParam = (RemoveCacheParam)param; if (cParam.IsUsage) { AssemblyUsage.PrintLogo(cParam.IsLogo); AssemblyUsage.PrintUsage(); return; } if (!ValidateParameters()) return; if (cParam.Port != -1) { NCache.Port = cParam.Port; } if (cParam.Port == -1) NCache.Port = NCache.UseTcp ? CacheConfigManager.NCacheTcpPort : CacheConfigManager.HttpPort; if (cParam.Server != null || cParam.Server != string.Empty) { NCache.ServerName = cParam.Server; } cacheServer = NCache.GetCacheServer(new TimeSpan(0, 0, 0, 30)); Console.WriteLine("\nRemoving cache '{0}' on server {1}:{2}.", cParam.CacheId, cacheServer.GetBindIP(), NCache.Port); if (cacheServer != null) { string getBindIp = string.Empty; try { Alachisoft.NCache.Config.NewDom.CacheServerConfig serverConfig = cacheServer.GetNewConfiguration(cParam.CacheId); if (serverConfig == null) { throw new Exception("Specified cache does not exist."); } if (serverConfig.CacheSettings.CacheType == "clustered-cache") { foreach (Address node in serverConfig.CacheDeployment.Servers.GetAllConfiguredNodes()) { try { NCache.ServerName = node.IpAddress.ToString(); cacheServer = NCache.GetCacheServer(new TimeSpan(0, 0, 0, 30)); cacheServer.UnregisterCache(cParam.CacheId, null, false); Console.WriteLine("Cache '{0}' successfully removed from server {1}:{2}.\n", cParam.CacheId, NCache.ServerName, NCache.Port); } catch (Exception ex) { Console.Error.WriteLine("Error: Failed to Rmove Cache '{0}' from server '{1}:{2}'. ", cParam.CacheId, NCache.ServerName, NCache.Port); Console.Error.WriteLine("Error Detail: '{0}'. ", ex.Message); LogEvent(ex.Message); } finally { cacheServer.Dispose(); } } } else { try { getBindIp = cacheServer.GetBindIP(); cacheServer.UnregisterCache(cParam.CacheId, null, false); Console.WriteLine("Cache '{0}' successfully removed from server {1}:{2}.\n", cParam.CacheId, getBindIp, NCache.Port); } catch (Exception e) { throw e; } } } catch (Exception ex) { Console.Error.WriteLine("Error: Failed to Rmove Cache '{0}' from server '{1}:{2}'. ", cParam.CacheId, cacheServer.GetBindIP(), NCache.Port); Console.Error.WriteLine(ex.Message); LogEvent(ex.Message); } } } catch (Exception e) { Console.Error.WriteLine("Error: {0}", e.Message); Console.Error.WriteLine(); Console.Error.WriteLine(e.ToString()); } finally { NCache.Dispose(); } }