Beispiel #1
0
 public void addZoneServer(zoneServerCluster zsc)
 {
     if (!zoneServer_dic.ContainsKey(zsc.clusterId))
     {
         zoneServer_dic.Add(zsc.clusterId, zsc);
     }
 }
Beispiel #2
0
        /// <summary>
        /// 同步更新zone服务器集群
        /// </summary>
        /// <param name="offobj"></param>
        public void rsycUpdate(zoneServerCluster offobj)
        {
            if (this.clusterId != offobj.clusterId)
            {
                //todoXout.LogInf("");
                return;// 有异常问题,待处理
            }

            if (offobj.master != null && offobj.master.id != localRunServer.Instance.ownServer.id)
            {
                this.master = offobj.master;
            }
            if (offobj.master == null)
            {
                this.master = null;
            }
            if (offobj.slave != null && offobj.slave.id != localRunServer.Instance.ownServer.id)
            {
                this.slave = offobj.slave;
            }
            if (offobj.slave == null)
            {
                this.slave = null;
            }

            this.regionName = offobj.regionName;
            this.zoneName   = offobj.zoneName;
            foreach (var one in offobj.repetionList)
            {
                if (one.id == localRunServer.Instance.ownServer.id)
                {
                    continue;
                }
                var old = (from x in repetionList where x.id == one.id select x).FirstOrDefault();
                if (old == null)
                {
                    repetionList.Add(old);
                }
                else
                {
                    old = one;
                }
            }
        }
Beispiel #3
0
 public static zoneServerCluster parlseJson(string jsonstr)
 {
     _instance = JsonConvert.DeserializeObject <zoneServerCluster>(jsonstr);
     return(_instance);
 }