/// <summary> /// /// </summary> /// <param name="stateProvider">Comet状态记录器</param> /// <param name="workerThreadCount">工作线程数量</param> /// <param name="maximumTimeSlot">超时时间</param> public CometStateManager(ICometStateProvider stateProvider, int workerThreadCount, int maximumTimeSlot) { if (stateProvider == null) { throw new ArgumentNullException("stateProvider"); } if (workerThreadCount <= 0) { throw new ArgumentOutOfRangeException("workerThreadCount"); } StateProvider = stateProvider; this.workerThreadCount = workerThreadCount; this.maximumTimeSlot = maximumTimeSlot; // 初始化指定数量工作线程 workerThreads = new CometWaitThread[workerThreadCount]; for (int i = 0; i < workerThreadCount; i++) { workerThreads[i] = new CometWaitThread(this); } }
public CometStateManager(ICometStateProvider stateProvider) : this(stateProvider, 5, 100) { }