public void TimerProc(object sender, EventArgs e) { try { string huanYingSiYuanUri = CoreInterface.GetRuntimeVariable(RuntimeVariableNames.HuanYingSiYuanUri, null); if (RemoteServiceUri != huanYingSiYuanUri) { RemoteServiceUri = huanYingSiYuanUri; } IKuaFuService kuaFuService = GetKuaFuService(); if (null != kuaFuService) { if (ClientInfo.ClientId > 0) { List <KuaFuServerInfo> dict = kuaFuService.GetKuaFuServerInfoData(ServerInfoAsyncAge); if (null != dict && dict.Count > 0) { lock (Mutex) { ServerIdServerInfoDict.Clear(); bool first = true; foreach (var item in dict) { ServerIdServerInfoDict[item.ServerId] = item; if (first) { first = false; ServerInfoAsyncAge = item.Age; } if (ClientInfo.ServerId == item.ServerId) { LocalServerFlags = item.Flags; } } } } //同步数据 AsyncDataItem[] items = kuaFuService.GetClientCacheItems(ClientInfo.ServerId); if (null != items && items.Length > 0) { //ThreadPool.QueueUserWorkItem(new WaitCallback(ExecuteEventCallBackAsync), items); ExecuteEventCallBackAsync(items); } } } } catch (System.Exception ex) { ResetKuaFuService(); } }
public void TimerProc(object sender, EventArgs e) { try { string huanYingSiYuanUri = this.CoreInterface.GetRuntimeVariable("HuanYingSiYuanUri", null); if (this.RemoteServiceUri != huanYingSiYuanUri) { this.RemoteServiceUri = huanYingSiYuanUri; } IKuaFuService kuaFuService = this.GetKuaFuService(false); if (null != kuaFuService) { if (this.ClientInfo.ClientId > 0) { List <KuaFuServerInfo> dict = kuaFuService.GetKuaFuServerInfoData(KuaFuManager.getInstance().GetServerInfoAsyncAge()); KuaFuManager.getInstance().UpdateServerInfoList(dict); AsyncData asyncData = kuaFuService.GetClientCacheItems2(this.ClientInfo.ServerId, TimeUtil.NOW()); long nowTicks = TimeUtil.NOW(); long subTicks = nowTicks - asyncData.RequestTicks; if (subTicks < 200L) { if (TimeUtil.AsyncNetTicks(asyncData.RequestTicks, asyncData.ServerTicks)) { LogManager.WriteLog(LogTypes.Ignore, string.Format("时间漂移#local={0},server={1}", asyncData.RequestTicks, asyncData.ServerTicks), null, true); } } AsyncDataItem[] items = asyncData.ItemList; if (items != null && items.Length > 0) { this.ExecuteEventCallBackAsync(items); } } } } catch (Exception ex) { this.ResetKuaFuService(); } }