public void AbortRuntime(int sessionId) { // 如果全局状态不能Abort则返回 if (!ModuleUtils.CanBeAborted(_globalInfo.StateMachine.State)) { return; } if (sessionId == CommonConst.TestGroupSession || sessionId == CommonConst.BroadcastSession) { this._globalInfo.StateMachine.State = RuntimeState.AbortRequested; List <int> sessionIds = new List <int>(_controller.TestMaintainer.TestContainers.Keys); foreach (int session in sessionIds.Where(session => ModuleUtils.CanBeAborted(_statusManager[session].State))) { _controller.Abort(session); } } else if (ModuleUtils.CanBeAborted(_statusManager[sessionId].State)) { _controller.Abort(sessionId); } }