Ejemplo n.º 1
0
        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());
        }
Ejemplo n.º 2
0
		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);
		}
Ejemplo n.º 3
0
            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);
            }
Ejemplo n.º 4
0
        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);
            }
        }