/// <summary> /// 查询eSight列表(数据库中的数据,而不是ESSession) /// </summary> /// <returns>eSight列表</returns> public IList <HWESightHost> ListESHost() { IHWESightHostDal hwESightHostDal = HWESightHostDal.Instance; IList <HWESightHost> hostList = hwESightHostDal.GetList("1=1"); return(hostList); }
/// <summary> /// 初始化所有的eSight连接的配置信息。 /// 注意,并没有open。 /// </summary> /// <param name="timeoutSec">连接超时时间,默认为ConstMgr.HWESightHost.DEFAULT_TIMEOUT_SEC</param> public void InitESSessions(int timeoutSec = ConstMgr.HWESightHost.DEFAULT_TIMEOUT_SEC) { IHWESightHostDal hwESightHostDal = HWESightHostDal.Instance; IList <HWESightHost> hostList = hwESightHostDal.GetList("1=1");//获取eSight foreach (HWESightHost hwESightHost in hostList) { lock (eSightSessions) //开锁 { if (!eSightSessions.ContainsKey(hwESightHost.HostIP.ToUpper())) //判断是否已经在内存中存在,防止反复初始化。 { IESSession iESSession = new ESSession(); iESSession.SetHttpMode(_isHttps); iESSession.InitESight(hwESightHost, timeoutSec); eSightSessions[hwESightHost.HostIP.ToUpper()] = iESSession; } } } }