Search in sources :

Example 1 with RegException

use of com.vip.saturn.job.reg.exception.RegException in project Saturn by vipshop.

the class ExecutionService method updateErrorJobReturnIfPossible.

private void updateErrorJobReturnIfPossible(JobExecutionMultipleShardingContext jobExecutionShardingContext, int item) {
    if (jobExecutionShardingContext instanceof SaturnExecutionContext) {
        // 为了展现分片处理失败的状态
        SaturnExecutionContext saturnContext = (SaturnExecutionContext) jobExecutionShardingContext;
        if (!saturnContext.isSaturnJob()) {
            return;
        }
        SaturnJobReturn jobRet = saturnContext.getShardingItemResults().get(item);
        try {
            if (jobRet != null) {
                int errorGroup = jobRet.getErrorGroup();
                if (errorGroup == SaturnSystemErrorGroup.TIMEOUT) {
                    getJobNodeStorage().createJobNodeIfNeeded(ExecutionNode.getTimeoutNode(item));
                } else if (errorGroup != SaturnSystemErrorGroup.SUCCESS) {
                    getJobNodeStorage().createJobNodeIfNeeded(ExecutionNode.getFailedNode(item));
                }
            } else {
                getJobNodeStorage().createJobNodeIfNeeded(ExecutionNode.getFailedNode(item));
            }
        } catch (RegException e) {
            LogUtils.warn(log, jobName, "update job return fail.", e);
        }
    }
}
Also used : SaturnJobReturn(com.vip.saturn.job.SaturnJobReturn) RegException(com.vip.saturn.job.reg.exception.RegException)

Aggregations

SaturnJobReturn (com.vip.saturn.job.SaturnJobReturn)1 RegException (com.vip.saturn.job.reg.exception.RegException)1