void CCommandPra::CmdAppStart(CProtocol& a_clsRecvP, CProcessManager& a_clsPM) { if (a_clsRecvP.IsFlagNotify() == false) { g_pclsLogPra->WARNING("CMD 'APP_START', not set notify flag"); } CCmdBase clsBase; if (clsBase.NotifyParse(a_clsRecvP.GetPayload().c_str()) == false) { g_pclsLogPra->ERROR("CMD 'APP_START', invalied body format"); return; } if (clsBase.m_bIsAll) { // 전체 프로세스 실행 요청 a_clsPM.Run(-1); } else { // 지정 프로세스의 실행 요청 list<pair<int, string> >::iterator iter = clsBase.m_lstTarget.begin(); for (; iter != clsBase.m_lstTarget.end(); ++iter) { a_clsPM.Run(iter->first); } } return; }
void CCommandPra::CmdAppKill(CProtocol& a_clsRecvP, CProcessManager& a_clsPM) { if (a_clsRecvP.IsFlagNotify() == false) { g_pclsLogPra->WARNING("CMD 'APP_KILL', not set notify flag"); } CCmdBase clsBase; if (clsBase.NotifyParse(a_clsRecvP.GetPayload().c_str()) == false) { g_pclsLogPra->ERROR("CMD 'APP_KILL', invalied body format"); return; } if (clsBase.m_bIsAll) { // 전체 프로세스 강제 종료 a_clsPM.StopForceibly(); } else { // 지정 프로세스의 강제 종료 auto iter = clsBase.m_lstTarget.begin(); for (; iter != clsBase.m_lstTarget.end(); ++iter) { a_clsPM.StopForceibly(iter->first); } } return; }
void CCommandPra::CmdAppReconfig(CProtocol& a_clsRecvP, CProcessManager& a_clsPM) { CProtocol clsResp; CCmdBase clsBase; if (a_clsRecvP.IsFlagNotify() == false) { g_pclsLogPra->WARNING("CMD, 'PRA_RECONFIG', check notify flag"); return; } CConfigPra& clsCfg = CConfigPra::Instance(); CMesgRoute& clsRoute = CMesgRoute::Instance(); CAddress& clsAddr = CAddress::Instance(); list<CProcessManager::ST_APPINFO> lstProcess; clsCfg.LoadProcess(lstProcess); // 현재 프로세스의 비활성화 flag 설정 a_clsPM.Disable(); for (auto iter = lstProcess.begin(); iter != lstProcess.end(); ++iter) { a_clsPM.Add(*iter); clsAddr.AddApp(iter->m_strPkgName.c_str(), iter->m_strNodeType.c_str(), iter->m_strProcName.c_str(), iter->m_nProcNo); clsRoute.AddRoute(iter->m_nProcNo, clsCfg.m_nProcNo); } clsRoute.PrintTable(g_pclsLogPra, LV_INFO); return; }
void CCommandPra::CmdAppLogLevel(CProtocol& a_clsRecvP, CProcessManager& a_clsPM) { CConfigPra& clsCfg = CConfigPra::Instance(); CAppQueue& clsQ = CAppQueue::Instance(); CCmdAppLogLevel clsLog; // Notify parsing string strBody; CCmdAppCtl clsCtl; // APP에 보낼 body 메세지 CProtocol clsSendP; // APP에 보낼 message if (a_clsRecvP.IsFlagNotify() == false) { g_pclsLogPra->WARNING("CMD, 'LOG_LEVEL' not set notify flag"); } if (clsLog.NotifyParse(a_clsRecvP.GetPayload().c_str()) == false) { g_pclsLogPra->ERROR("CMD, 'LOG_LEVEL' invalied body format"); return; } // 프로세스 보낼 메세지 구성 clsCtl.m_strAction = "LOG_LEVEL"; clsCtl.m_nOption = clsLog.m_nLogLevel; clsSendP.SetCommand(CMD_APP_CTL); clsSendP.SetFlagRequest(); clsSendP.SetSource(clsCfg.m_nNodeNo, clsCfg.m_nProcNo); clsSendP.SetSequence(); clsSendP.SetPayload(clsCtl.RequestGen()); if (clsLog.m_bIsAll) { // 전체 프로세스 loglevel 변경 요청 vector<CProcessManager::ST_APPINFO> vecInfo; a_clsPM.GetAppInfo(vecInfo, CProcStatus::RUNNING); for (size_t i=0; i < vecInfo.size(); ++i) { clsSendP.SetDestination(clsCfg.m_nNodeNo, vecInfo[i].m_nProcNo); if (clsQ.SendCmd(clsSendP, vecInfo[i].m_strProcName.c_str()) == false) { g_pclsLogPra->ERROR("APP loglevel send failed"); } } } else { // 지정 프로세스의 loglevel 변경 요청 list<pair<int, string> >::iterator iter = clsLog.m_lstTarget.begin(); for (; iter != clsLog.m_lstTarget.end(); ++iter) { clsSendP.SetDestination(clsCfg.m_nNodeNo, iter->first); if (clsQ.SendCmd(clsSendP, iter->second.c_str()) == false) { g_pclsLogPra->ERROR("APP loglevel send failed"); } } } return; }