|
@@ -1384,100 +1384,6 @@ namespace
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-ErrorCodeEnum CHealthManagerEntity::DealSpecifiedEntity(DealType type, LPCTSTR lpcszEntityName, LPCTSTR lpcszCmdline, bool bForce, CSimpleStringA& strErrMsg)
|
|
|
-{
|
|
|
- ErrorCodeEnum result(Error_Succeed);
|
|
|
- strErrMsg.Clear();
|
|
|
-
|
|
|
- switch (type) {
|
|
|
- case Deal_Start:
|
|
|
- {
|
|
|
- CSmartPointer<IEntityFunction> pFunc = GetFunction();
|
|
|
- CSmartPointer<IEntityFunctionPrivilege> pFuncPrivilege = pFunc.ConvertCase<IEntityFunctionPrivilege>();
|
|
|
- CSimpleStringA strEntityName(lpcszEntityName);
|
|
|
- CEntityRunInfo info = {};
|
|
|
- result = GetFunction()->GetEntityRunInfo(strEntityName, info);
|
|
|
- bool toStart(true);
|
|
|
- Dbg("entity: %s, %s,%s", strEntityName.GetData(), SpStrError(result), SpStrEntityState(info.eState));
|
|
|
- if ((info.eState != EntityState_NoStart && info.eState == EntityState_Lost
|
|
|
- && info.eState == EntityState_Close && info.eState == EntityState_UnLoading)
|
|
|
- && (bForce)) {
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- if (info.eState != EntityState_NoStart && bForce) {
|
|
|
- Dbg("to terminal entity..");
|
|
|
- CSmartPointer<IAsynWaitSp> spWait;
|
|
|
- result = pFuncPrivilege->StopEntity(strEntityName, spWait);
|
|
|
- Dbg("stop entity return %s", SpStrError(result));
|
|
|
- if (result == Error_Succeed && spWait != NULL) {
|
|
|
- Dbg("to wait after stop...");
|
|
|
- result = spWait->WaitAnswer(60 * 1000);
|
|
|
- Dbg("wait result: %s", SpStrError(result));
|
|
|
- if (result != Error_Succeed) {
|
|
|
- CSmartPointer<IAsynWaitSp> spWait2;
|
|
|
- result = pFuncPrivilege->TerminateEntity(strEntityName, spWait2);
|
|
|
- Dbg("terminal entity return %s", SpStrError(result));
|
|
|
- if (result == Error_Succeed && spWait2 != NULL) {
|
|
|
- Dbg("to wait after terminal...");
|
|
|
- result = spWait2->WaitAnswer(60 * 1000);
|
|
|
- Dbg("wait result: %s", SpStrError(result));
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- if (result != Error_Succeed) {
|
|
|
- strErrMsg = CSimpleStringA::Format("重启前停止实体失败 %s, %s", SpStrEntityState(info.eState), SpStrError(result));
|
|
|
- toStart = false;
|
|
|
- }
|
|
|
- }
|
|
|
- else if (info.eState != EntityState_NoStart) {
|
|
|
- result = Error_InvalidState;
|
|
|
- strErrMsg = CSimpleStringA::Format("实体[%s]当前状态(%s)不支持该操作", strEntityName.GetData(), SpStrEntityState(info.eState));
|
|
|
- toStart = false;
|
|
|
- }
|
|
|
-
|
|
|
- if (toStart) {
|
|
|
- Dbg("to start entity..");
|
|
|
- CSmartPointer<IAsynWaitSp> spWait;
|
|
|
- result = pFuncPrivilege->StartEntity(strEntityName, lpcszCmdline, spWait);
|
|
|
- Dbg("start entity return %s", SpStrError(result));
|
|
|
- if (result == Error_Succeed && spWait != NULL) {
|
|
|
- Dbg("to wait...");
|
|
|
- result = spWait->WaitAnswer(60 * 1000);
|
|
|
- Dbg("wait result: %s", SpStrError(result));
|
|
|
- }
|
|
|
- if (result != Error_Succeed) {
|
|
|
- strErrMsg = CSimpleStringA::Format("启动实体失败 %s", SpStrError(result));
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- break;
|
|
|
- case Deal_Close:
|
|
|
- result = Error_NotImpl;
|
|
|
- break;
|
|
|
- case Deal_Pause:
|
|
|
- result = Error_NotImpl;
|
|
|
- break;
|
|
|
- case Deal_Continue:
|
|
|
- result = Error_NotImpl;
|
|
|
- break;
|
|
|
- case Deal_Kill:
|
|
|
- result = Error_NotImpl;
|
|
|
- break;
|
|
|
- case Deal_Test:
|
|
|
- result = Error_NotImpl;
|
|
|
- break;
|
|
|
- case Deal_Restart:
|
|
|
- result = Error_NotImpl;
|
|
|
- break;
|
|
|
- default:
|
|
|
- result = Error_NotSupport;
|
|
|
- break;
|
|
|
- }
|
|
|
- return result;
|
|
|
-}
|
|
|
-
|
|
|
bool CHealthManagerEntity::IsTestMode()
|
|
|
{
|
|
|
static int flag = -1;
|