/** * 获取运行结果信息 * * @author:LKJ */ public String getStdout(Server server, WorldServer worldServer, HttpSession session) throws Exception { boolean successResult = false; boolean exceptionResult = false; String result = ""; Object[] stdResult = SshxcuteUtils.showStdout(server, worldServer.getPath()); String successStr = Global.WORLD_SUCCESS_RESULT; String exceptionStr = "Exception"; if (stdResult != null && stdResult.length > 0 && stdResult[1] != null) { successResult = CommonUtil.Pattern(successStr, stdResult[1].toString()); exceptionResult = CommonUtil.Pattern(exceptionStr, stdResult[1].toString()); } if (exceptionResult) { result = "false"; SystemLogService.worldServerLog( session, ":" + worldServer.getId() + "," + stdResult[1].toString()); } else if (successResult) { result = "true"; CacheService.getWorldServerById(worldServer.getId()).setState(CommanConstant.STATE_START); worldServer.setState(CommanConstant.STATE_START); Application.getBean(WorldServerService.class).update(worldServer); } return result; }
@Override public void writeBatchLog(HttpSession session, String logContent) { SystemLogService.batchWorldLog(session, logContent); }