/// <summary> /// 初始化请求 /// </summary> protected virtual void InitRequest() { this.reqPool = new ServiceRequestPool(node.MaxPool); lock (this.reqPool) { this.poolSize = node.MinPool; //服务请求池化,使用最小的池初始化 for (int i = 0; i < node.MinPool; i++) { this.reqPool.Push(CreateRequest()); } } }
/// <summary> /// 清理资源 /// </summary> public void Dispose() { try { while (reqPool.Count > 0) { var reqService = reqPool.Pop(); reqService.Dispose(); } } catch (Exception) { } this.reqPool = null; }