/// <summary> /// Stop and remove a server from the cluster /// </summary> public bool Remove(string label) { if (!Servers.ContainsKey(label)) { return(true); } OnBeforeStopEach?.Invoke(); Servers[label].Stop(); OnAfterStopEach?.Invoke(); return(Servers.Remove(label)); }
/// <summary> /// Stops each server in the cluster /// </summary> public void StopAll() { OnBeforeStopAll?.Invoke(); foreach (var server in Servers.Values.Where(server => server.IsListening)) { OnBeforeStopEach?.Invoke(); server.Stop(); OnAfterStopEach?.Invoke(); } OnAfterStopAll?.Invoke(); Started = false; }
/// <summary> /// Stop and remove a server from the cluster /// </summary> public bool Remove(string label) { if (!Servers.ContainsKey(label)) { return(true); } var server = Get(label); if (Started) { OnBeforeStopEach?.Invoke(server); server.Stop(); OnAfterStopEach?.Invoke(server); } return(Servers.Remove(label)); }