public virtual void TaskCloseAndTurnOnNextDomain() { m_status = VBATaskStatus.TurnToNext; }
public virtual void Reset() { m_taskht.Clear(); m_url = null; m_status = VBATaskStatus.Ready; }
public virtual void TaskRestartADSL() { m_status = VBATaskStatus.RestartADSL; }
public virtual void TaskClose() { m_status = VBATaskStatus.Close; }
public virtual void TaskFail() { m_status = VBATaskStatus.Failure; }
public virtual void TaskFail() { m_status = VBATaskStatus.Failure; }
public virtual void Reset() { m_taskht.Clear(); m_url = null; m_status = VBATaskStatus.Ready; }
public virtual void TaskCloseAndTurnOnNextDomain() { m_status = VBATaskStatus.TurnToNext; }
public virtual void TaskClose() { m_status = VBATaskStatus.Close; }
public virtual void TaskRestartADSL() { m_status = VBATaskStatus.RestartADSL ; }
protected void ScriptThreadRunner() { //实现BeforeTask事件 if (BeforeScript != null) { BeforeScript(this, null); } try { //Log开始 GetLogger().LogListLog(VBALogLevelFlag.Debug, this.Name + " start...[running time: " + m_runningtime.ToString() + "] [at " + System.Net.Dns.GetHostName() + "]"); //执行脚本,带空脚本处理 if (m_script != null && m_script != "") { m_engine.Run(); } //关闭引擎 EngineClose(); //从VBATask中得到Task状态 VBATaskStatus ts = (m_vbaobjs["Task"] as VBATask).CurrentVBATaskStatus; switch (ts) { case VBATaskStatus.Failure: GetLogger().LogListLog(VBALogLevelFlag.Debug, this.Name + " fail..."); m_taskstatus = TaskStatus.Failure; break; case VBATaskStatus.RestartADSL: //重置ADSL(Client) if (ADSLFactory.Reconnect()) { GetLogger().LogListLog(VBALogLevelFlag.Debug, this.Name + " restart ADSL...succeed!"); m_taskstatus = TaskStatus.Restart; } else { GetLogger().LogListLog(VBALogLevelFlag.Debug, this.Name + " restarting ADSL failed... setting this task failure!"); m_taskstatus = TaskStatus.Failure; } break; case VBATaskStatus.Ready: m_taskstatus = TaskStatus.Succeed; GetLogger().LogListLog(VBALogLevelFlag.Debug, this.Name + " succeed..."); break; case VBATaskStatus.Error: m_taskstatus = TaskStatus.Error; GetLogger().LogListLog(VBALogLevelFlag.Error, this.Name + " set error by customer..."); break; case VBATaskStatus.Close: m_taskstatus = TaskStatus.Succeed; GetLogger().LogListLog(VBALogLevelFlag.Warn, this.Name + " close whole domain!"); Domain d = DomainManager.GetDomain(m_domainGUID); if (d.Enable) { d.Enable = false; } break; case VBATaskStatus.TurnToNext: m_taskstatus = TaskStatus.Succeed; GetLogger().LogListLog(VBALogLevelFlag.Warn, this.Name + " close and turn to next domain!"); Domain dd = DomainManager.GetDomain(m_domainGUID); if (dd.Enable || dd.Priority == DomainPriority.OneTime) { DomainManager.TurnToNextDomain(m_domainGUID); } break; default: m_taskstatus = TaskStatus.Succeed; GetLogger().LogListLog(VBALogLevelFlag.Debug, this.Name + " succeed..."); break; } } catch (Exception e) { if (m_IsClosing) { log.Warn(this.Name + " closed by force..."); GetLogger().LogListLog(VBALogLevelFlag.Warn, this.Name + " closed..."); m_taskstatus = TaskStatus.Closing; } else { GetLogger().LogListLog(VBALogLevelFlag.Error, this.Name + " runtime error..." + ParserErrorString(e)); log.Error(this.Name + " runtime error: ", e); m_errortime++; m_taskstatus = TaskStatus.Error; } } finally { //实现AfterTask事件 if (AfterScript != null) { AfterScript(this, null); } } }