Search in sources :

Example 6 with ExecutorBiz

use of com.xxl.job.core.biz.ExecutorBiz in project xxl-job by xuxueli.

the class JobLogController method logDetailCat.

@RequestMapping("/logDetailCat")
@ResponseBody
public ReturnT<LogResult> logDetailCat(String executorAddress, long triggerTime, int logId, int fromLineNum) {
    try {
        ExecutorBiz executorBiz = XxlJobDynamicScheduler.getExecutorBiz(executorAddress);
        ReturnT<LogResult> logResult = executorBiz.log(triggerTime, logId, fromLineNum);
        // is end
        if (logResult.getContent() != null && logResult.getContent().getFromLineNum() > logResult.getContent().getToLineNum()) {
            XxlJobLog jobLog = xxlJobLogDao.load(logId);
            if (jobLog.getHandleCode() > 0) {
                logResult.getContent().setEnd(true);
            }
        }
        return logResult;
    } catch (Exception e) {
        logger.error(e.getMessage(), e);
        return new ReturnT<LogResult>(ReturnT.FAIL_CODE, e.getMessage());
    }
}
Also used : ExecutorBiz(com.xxl.job.core.biz.ExecutorBiz) LogResult(com.xxl.job.core.biz.model.LogResult) XxlJobLog(com.xxl.job.admin.core.model.XxlJobLog) ParseException(java.text.ParseException) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 7 with ExecutorBiz

use of com.xxl.job.core.biz.ExecutorBiz in project xxl-job by xuxueli.

the class ExecutorRouteFailover method routeRun.

@Override
public ReturnT<String> routeRun(TriggerParam triggerParam, ArrayList<String> addressList) {
    StringBuffer beatResultSB = new StringBuffer();
    for (String address : addressList) {
        // beat
        ReturnT<String> beatResult = null;
        try {
            ExecutorBiz executorBiz = XxlJobDynamicScheduler.getExecutorBiz(address);
            beatResult = executorBiz.beat();
        } catch (Exception e) {
            logger.error(e.getMessage(), e);
            beatResult = new ReturnT<String>(ReturnT.FAIL_CODE, "" + e);
        }
        beatResultSB.append((beatResultSB.length() > 0) ? "<br><br>" : "").append(I18nUtil.getString("jobconf_beat") + ":").append("<br>address:").append(address).append("<br>code:").append(beatResult.getCode()).append("<br>msg:").append(beatResult.getMsg());
        // beat success
        if (beatResult.getCode() == ReturnT.SUCCESS_CODE) {
            ReturnT<String> runResult = XxlJobTrigger.runExecutor(triggerParam, address);
            beatResultSB.append("<br><br>").append(runResult.getMsg());
            // result
            runResult.setMsg(beatResultSB.toString());
            runResult.setContent(address);
            return runResult;
        }
    }
    return new ReturnT<String>(ReturnT.FAIL_CODE, beatResultSB.toString());
}
Also used : ExecutorBiz(com.xxl.job.core.biz.ExecutorBiz) ReturnT(com.xxl.job.core.biz.model.ReturnT)

Aggregations

ExecutorBiz (com.xxl.job.core.biz.ExecutorBiz)7 ReturnT (com.xxl.job.core.biz.model.ReturnT)4 XxlJobLog (com.xxl.job.admin.core.model.XxlJobLog)2 NetComClientProxy (com.xxl.job.core.rpc.netcom.NetComClientProxy)2 ParseException (java.text.ParseException)2 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)2 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)2 XxlJobInfo (com.xxl.job.admin.core.model.XxlJobInfo)1 LogResult (com.xxl.job.core.biz.model.LogResult)1 TriggerParam (com.xxl.job.core.biz.model.TriggerParam)1 Date (java.util.Date)1