private RemotingClientUtil() { _RemotingConfiguration = RemotingClientConfiguration.GetConfig(); if (_RemotingConfiguration == null) { return; } Dictionary <string, RemotingHost> hosts = _RemotingConfiguration.RemotingHosts; //生成所有远程对象代理并加载到内存 foreach (KeyValuePair <string, RemotingHost> kvp in hosts) { RemotingHost host = kvp.Value; LoadModulesByHost(host); } //检测每个客户端的可用服务器 RemotingHostCheck.Instance.DoCheck(); //如果检测服务器,则输出日志 if (_RemotingConfiguration.IsCheckServer) { System.Threading.Thread thread = new System.Threading.Thread(DoWork); //thread.IsBackground = true; thread.Start(); } }
/// <summary> /// 开始检测 /// </summary> public void DoCheck() { cfg = RemotingClientConfiguration.GetConfig(); if (cfg.IsCheckServer) { timer = new System.Timers.Timer(cfg.Interval); timer.Enabled = true; timer.Elapsed += new System.Timers.ElapsedEventHandler(timer_Elapsed); timer.Start(); } }
/// <summary> /// /// </summary> /// <param name="parent"></param> /// <param name="configContext"></param> /// <param name="section"></param> /// <returns></returns> public object Create(object parent, object configContext, System.Xml.XmlNode section) { RemotingClientConfiguration config = new RemotingClientConfiguration(); config.LoadValuesFromConfigurationXml(section); return config; }