public override string ToString() { StringBuilder b = new StringBuilder(); b.Append(pathType); b.Append("|"); b.Append(versionNumber); b.Append("|"); // Output the root servers list int sz = rootServers.Length; for (int i = 0; i < sz; ++i) { IServiceAddress addr = rootServers[i]; // The root leader has a "*" prefix if (addr.Equals(rootLeader)) { b.Append("*"); } b.Append(addr); if (i < rootServers.Length - 1) { b.Append("|"); } } return(b.ToString()); }
public override bool Equals(object obj) { PathInfo other = obj as PathInfo; if (other == null) return false; return pathName.Equals(other.pathName) && pathType.Equals(other.pathType) && versionNumber == other.versionNumber && rootLeader.Equals(other.rootLeader) && ListsEqual(rootServers, other.rootServers); }
public override bool Equals(object obj) { TrackedService other = obj as TrackedService; if (other == null) { return(false); } if (serviceAddress != other.serviceAddress && (serviceAddress == null || !serviceAddress.Equals(other.serviceAddress))) { return(false); } if (!serviceType.Equals(other.serviceType)) { return(false); } return(true); }
private void DeregisterManagerServer(IServiceAddress managerServerAddress) { // Create a list of servers to be deregistered, List<ManagerServiceInfo> toRemove; lock (managerServersList) { toRemove = new List<ManagerServiceInfo>(32); foreach (ManagerServiceInfo item in managerServersList) { if (item.Address.Equals(managerServerAddress)) { toRemove.Add(item); } } } // Remove the entries and persist lock (managerServersList) { // Remove the entries that match, foreach (ManagerServiceInfo item in toRemove) { managerServersList.Remove(item); // Add to the manager database managerDb.RemoveMachine(item.Address); } PersistManagerServers(managerServersList); // Clear the unique id if we are deregistering this service, if (managerServerAddress.Equals(address)) { managerUniqueId = -1; PersistManagerUniqueId(managerUniqueId); } } // Perform initialization on the manager managerDb.Initialize(); // Wait for initialization to complete, managerDb.WaitInitComplete(); // Remove the manager server entry, managerDb.SetValue("ms." + managerServerAddress, null); // Tell all the root servers of the new manager set, List<IServiceAddress> rootServersSet = new List<IServiceAddress>(64); lock (rootServersList) { foreach (RootServiceInfo rs in rootServersList) { rootServersSet.Add(rs.Address); } } foreach (IServiceAddress r in rootServersSet) { InformRootServerOfManagers(r); } }