refactor(core):重构核心包结构并优化错误处理

- 将核心业务接口和模型类迁移至 openapi 包下,规范模块划分
- 统一使用 XxlJobContext 中的状态码常量替代硬编码值
- 优化返回结果构造方式,提升代码可读性和维护性
- 调整部分字符串拼接逻辑,增强日志信息的准确性
- 更新文档中 API 服务位置说明,保持与实际代码一致
3.3.0-release
xuxueli 10 months ago
parent 517061690f
commit 57c328c729

@ -1003,7 +1003,7 @@ The scheduling center provides API services for executors and business parties t
3. Executor registration remove services; 3. Executor registration remove services;
4. Triggers a single execution service, and support the task to be triggered according to the business event; 4. Triggers a single execution service, and support the task to be triggered according to the business event;
The scheduling center API service location: com.xxl.job.core.biz.AdminBiz.java The scheduling center API service location: com.xxl.job.core.openapi.AdminBiz.java
The scheduling center API service requests reference codecom.xxl.job.adminbiz.AdminBizTest.java The scheduling center API service requests reference codecom.xxl.job.adminbiz.AdminBizTest.java

@ -1775,7 +1775,7 @@ XXL-JOB 目标是一种跨平台、跨语言的任务调度规范和协议。
### 6.1 调度中心 RESTful API ### 6.1 调度中心 RESTful API
API服务位置com.xxl.job.core.biz.AdminBiz com.xxl.job.admin.controller.JobApiController API服务位置com.xxl.job.core.openapi.AdminBiz com.xxl.job.admin.controller.JobApiController
API服务请求参考代码com.xxl.job.adminbiz.AdminBizTest API服务请求参考代码com.xxl.job.adminbiz.AdminBizTest
#### a、任务回调 #### a、任务回调
@ -1857,7 +1857,7 @@ Header
### 6.2 执行器 RESTful API ### 6.2 执行器 RESTful API
API服务位置com.xxl.job.core.biz.ExecutorBiz API服务位置com.xxl.job.core.openapi.ExecutorBiz
API服务请求参考代码com.xxl.job.executorbiz.ExecutorBizTest API服务请求参考代码com.xxl.job.executorbiz.ExecutorBizTest
#### a、心跳检测 #### a、心跳检测

@ -10,7 +10,7 @@ import com.xxl.job.admin.scheduler.type.ScheduleTypeEnum;
import com.xxl.job.admin.service.XxlJobService; import com.xxl.job.admin.service.XxlJobService;
import com.xxl.job.admin.util.I18nUtil; import com.xxl.job.admin.util.I18nUtil;
import com.xxl.job.admin.util.JobGroupPermissionUtil; import com.xxl.job.admin.util.JobGroupPermissionUtil;
import com.xxl.job.core.biz.model.ReturnT; import com.xxl.job.core.openapi.model.ReturnT;
import com.xxl.job.core.enums.ExecutorBlockStrategyEnum; import com.xxl.job.core.enums.ExecutorBlockStrategyEnum;
import com.xxl.job.core.glue.GlueTypeEnum; import com.xxl.job.core.glue.GlueTypeEnum;
import com.xxl.sso.core.helper.XxlSsoHelper; import com.xxl.sso.core.helper.XxlSsoHelper;

@ -6,7 +6,7 @@ import com.xxl.job.admin.mapper.XxlJobUserMapper;
import com.xxl.job.admin.model.XxlJobGroup; import com.xxl.job.admin.model.XxlJobGroup;
import com.xxl.job.admin.model.XxlJobUser; import com.xxl.job.admin.model.XxlJobUser;
import com.xxl.job.admin.util.I18nUtil; import com.xxl.job.admin.util.I18nUtil;
import com.xxl.job.core.biz.model.ReturnT; import com.xxl.job.core.openapi.model.ReturnT;
import com.xxl.sso.core.annotation.XxlSso; import com.xxl.sso.core.annotation.XxlSso;
import com.xxl.sso.core.helper.XxlSsoHelper; import com.xxl.sso.core.helper.XxlSsoHelper;
import com.xxl.sso.core.model.LoginInfo; import com.xxl.sso.core.model.LoginInfo;

@ -6,7 +6,7 @@ import com.xxl.job.admin.model.XxlJobGroup;
import com.xxl.job.admin.model.XxlJobInfo; import com.xxl.job.admin.model.XxlJobInfo;
import com.xxl.job.admin.model.XxlJobLog; import com.xxl.job.admin.model.XxlJobLog;
import com.xxl.job.admin.util.I18nUtil; import com.xxl.job.admin.util.I18nUtil;
import com.xxl.tool.response.ResponseCode; import com.xxl.job.core.context.XxlJobContext;
import jakarta.mail.internet.MimeMessage; import jakarta.mail.internet.MimeMessage;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -41,10 +41,10 @@ public class EmailJobAlarm implements JobAlarm {
// alarmContent // alarmContent
String alarmContent = "Alarm Job LogId=" + jobLog.getId(); String alarmContent = "Alarm Job LogId=" + jobLog.getId();
if (jobLog.getTriggerCode() != ResponseCode.CODE_200.getCode()) { if (jobLog.getTriggerCode() != XxlJobContext.HANDLE_CODE_SUCCESS) {
alarmContent += "<br>TriggerMsg=<br>" + jobLog.getTriggerMsg(); alarmContent += "<br>TriggerMsg=<br>" + jobLog.getTriggerMsg();
} }
if (jobLog.getHandleCode()>0 && jobLog.getHandleCode() != ResponseCode.CODE_200.getCode()) { if (jobLog.getHandleCode()>0 && jobLog.getHandleCode() != XxlJobContext.HANDLE_CODE_SUCCESS) {
alarmContent += "<br>HandleCode=" + jobLog.getHandleMsg(); alarmContent += "<br>HandleCode=" + jobLog.getHandleMsg();
} }

@ -6,8 +6,8 @@ import com.xxl.job.admin.scheduler.complete.JobCompleter;
import com.xxl.job.admin.scheduler.thread.*; import com.xxl.job.admin.scheduler.thread.*;
import com.xxl.job.admin.scheduler.trigger.JobTrigger; import com.xxl.job.admin.scheduler.trigger.JobTrigger;
import com.xxl.job.admin.util.I18nUtil; import com.xxl.job.admin.util.I18nUtil;
import com.xxl.job.core.biz.ExecutorBiz; import com.xxl.job.core.openapi.ExecutorBiz;
import com.xxl.job.core.biz.client.ExecutorBizClient; import com.xxl.job.core.openapi.client.ExecutorBizClient;
import com.xxl.job.core.enums.ExecutorBlockStrategyEnum; import com.xxl.job.core.enums.ExecutorBlockStrategyEnum;
import com.xxl.tool.core.StringTool; import com.xxl.tool.core.StringTool;
import jakarta.annotation.Resource; import jakarta.annotation.Resource;

@ -1,10 +1,10 @@
package com.xxl.job.admin.scheduler.openapi; package com.xxl.job.admin.scheduler.openapi;
import com.xxl.job.admin.scheduler.config.XxlJobAdminBootstrap; import com.xxl.job.admin.scheduler.config.XxlJobAdminBootstrap;
import com.xxl.job.core.biz.AdminBiz; import com.xxl.job.core.openapi.AdminBiz;
import com.xxl.job.core.biz.model.HandleCallbackRequest; import com.xxl.job.core.openapi.model.HandleCallbackRequest;
import com.xxl.job.core.biz.model.RegistryRequest; import com.xxl.job.core.openapi.model.RegistryRequest;
import com.xxl.job.core.biz.model.ReturnT; import com.xxl.job.core.openapi.model.ReturnT;
import com.xxl.job.core.util.XxlJobRemotingUtil; import com.xxl.job.core.util.XxlJobRemotingUtil;
import com.xxl.sso.core.annotation.XxlSso; import com.xxl.sso.core.annotation.XxlSso;
import com.xxl.tool.core.StringTool; import com.xxl.tool.core.StringTool;

@ -1,6 +1,6 @@
package com.xxl.job.admin.scheduler.route; package com.xxl.job.admin.scheduler.route;
import com.xxl.job.core.biz.model.TriggerRequest; import com.xxl.job.core.openapi.model.TriggerRequest;
import com.xxl.tool.response.Response; import com.xxl.tool.response.Response;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;

@ -3,9 +3,9 @@ package com.xxl.job.admin.scheduler.route.strategy;
import com.xxl.job.admin.scheduler.config.XxlJobAdminBootstrap; import com.xxl.job.admin.scheduler.config.XxlJobAdminBootstrap;
import com.xxl.job.admin.scheduler.route.ExecutorRouter; import com.xxl.job.admin.scheduler.route.ExecutorRouter;
import com.xxl.job.admin.util.I18nUtil; import com.xxl.job.admin.util.I18nUtil;
import com.xxl.job.core.biz.ExecutorBiz; import com.xxl.job.core.openapi.ExecutorBiz;
import com.xxl.job.core.biz.model.IdleBeatRequest; import com.xxl.job.core.openapi.model.IdleBeatRequest;
import com.xxl.job.core.biz.model.TriggerRequest; import com.xxl.job.core.openapi.model.TriggerRequest;
import com.xxl.tool.response.Response; import com.xxl.tool.response.Response;
import java.util.List; import java.util.List;

@ -1,7 +1,7 @@
package com.xxl.job.admin.scheduler.route.strategy; package com.xxl.job.admin.scheduler.route.strategy;
import com.xxl.job.admin.scheduler.route.ExecutorRouter; import com.xxl.job.admin.scheduler.route.ExecutorRouter;
import com.xxl.job.core.biz.model.TriggerRequest; import com.xxl.job.core.openapi.model.TriggerRequest;
import com.xxl.tool.response.Response; import com.xxl.tool.response.Response;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;

@ -3,8 +3,8 @@ package com.xxl.job.admin.scheduler.route.strategy;
import com.xxl.job.admin.scheduler.config.XxlJobAdminBootstrap; import com.xxl.job.admin.scheduler.config.XxlJobAdminBootstrap;
import com.xxl.job.admin.scheduler.route.ExecutorRouter; import com.xxl.job.admin.scheduler.route.ExecutorRouter;
import com.xxl.job.admin.util.I18nUtil; import com.xxl.job.admin.util.I18nUtil;
import com.xxl.job.core.biz.ExecutorBiz; import com.xxl.job.core.openapi.ExecutorBiz;
import com.xxl.job.core.biz.model.TriggerRequest; import com.xxl.job.core.openapi.model.TriggerRequest;
import com.xxl.tool.response.Response; import com.xxl.tool.response.Response;
import java.util.List; import java.util.List;

@ -1,7 +1,7 @@
package com.xxl.job.admin.scheduler.route.strategy; package com.xxl.job.admin.scheduler.route.strategy;
import com.xxl.job.admin.scheduler.route.ExecutorRouter; import com.xxl.job.admin.scheduler.route.ExecutorRouter;
import com.xxl.job.core.biz.model.TriggerRequest; import com.xxl.job.core.openapi.model.TriggerRequest;
import com.xxl.tool.response.Response; import com.xxl.tool.response.Response;
import java.util.List; import java.util.List;

@ -1,7 +1,7 @@
package com.xxl.job.admin.scheduler.route.strategy; package com.xxl.job.admin.scheduler.route.strategy;
import com.xxl.job.admin.scheduler.route.ExecutorRouter; import com.xxl.job.admin.scheduler.route.ExecutorRouter;
import com.xxl.job.core.biz.model.TriggerRequest; import com.xxl.job.core.openapi.model.TriggerRequest;
import com.xxl.tool.response.Response; import com.xxl.tool.response.Response;
import java.util.*; import java.util.*;

@ -1,7 +1,7 @@
package com.xxl.job.admin.scheduler.route.strategy; package com.xxl.job.admin.scheduler.route.strategy;
import com.xxl.job.admin.scheduler.route.ExecutorRouter; import com.xxl.job.admin.scheduler.route.ExecutorRouter;
import com.xxl.job.core.biz.model.TriggerRequest; import com.xxl.job.core.openapi.model.TriggerRequest;
import com.xxl.tool.response.Response; import com.xxl.tool.response.Response;
import java.util.ArrayList; import java.util.ArrayList;

@ -1,7 +1,7 @@
package com.xxl.job.admin.scheduler.route.strategy; package com.xxl.job.admin.scheduler.route.strategy;
import com.xxl.job.admin.scheduler.route.ExecutorRouter; import com.xxl.job.admin.scheduler.route.ExecutorRouter;
import com.xxl.job.core.biz.model.TriggerRequest; import com.xxl.job.core.openapi.model.TriggerRequest;
import com.xxl.tool.response.Response; import com.xxl.tool.response.Response;
import java.util.List; import java.util.List;

@ -1,7 +1,7 @@
package com.xxl.job.admin.scheduler.route.strategy; package com.xxl.job.admin.scheduler.route.strategy;
import com.xxl.job.admin.scheduler.route.ExecutorRouter; import com.xxl.job.admin.scheduler.route.ExecutorRouter;
import com.xxl.job.core.biz.model.TriggerRequest; import com.xxl.job.core.openapi.model.TriggerRequest;
import com.xxl.tool.response.Response; import com.xxl.tool.response.Response;
import java.util.List; import java.util.List;

@ -1,7 +1,7 @@
package com.xxl.job.admin.scheduler.route.strategy; package com.xxl.job.admin.scheduler.route.strategy;
import com.xxl.job.admin.scheduler.route.ExecutorRouter; import com.xxl.job.admin.scheduler.route.ExecutorRouter;
import com.xxl.job.core.biz.model.TriggerRequest; import com.xxl.job.core.openapi.model.TriggerRequest;
import com.xxl.tool.response.Response; import com.xxl.tool.response.Response;
import java.util.List; import java.util.List;

@ -3,7 +3,7 @@ package com.xxl.job.admin.scheduler.thread;
import com.xxl.job.admin.model.XxlJobGroup; import com.xxl.job.admin.model.XxlJobGroup;
import com.xxl.job.admin.model.XxlJobRegistry; import com.xxl.job.admin.model.XxlJobRegistry;
import com.xxl.job.admin.scheduler.config.XxlJobAdminBootstrap; import com.xxl.job.admin.scheduler.config.XxlJobAdminBootstrap;
import com.xxl.job.core.biz.model.RegistryRequest; import com.xxl.job.core.openapi.model.RegistryRequest;
import com.xxl.job.core.enums.RegistryConfig; import com.xxl.job.core.enums.RegistryConfig;
import com.xxl.tool.core.StringTool; import com.xxl.tool.core.StringTool;
import com.xxl.tool.response.Response; import com.xxl.tool.response.Response;

@ -9,8 +9,9 @@ import com.xxl.job.admin.model.XxlJobLog;
import com.xxl.job.admin.scheduler.config.XxlJobAdminBootstrap; import com.xxl.job.admin.scheduler.config.XxlJobAdminBootstrap;
import com.xxl.job.admin.scheduler.route.ExecutorRouteStrategyEnum; import com.xxl.job.admin.scheduler.route.ExecutorRouteStrategyEnum;
import com.xxl.job.admin.util.I18nUtil; import com.xxl.job.admin.util.I18nUtil;
import com.xxl.job.core.biz.ExecutorBiz; import com.xxl.job.core.openapi.ExecutorBiz;
import com.xxl.job.core.biz.model.TriggerRequest; import com.xxl.job.core.openapi.model.TriggerRequest;
import com.xxl.job.core.context.XxlJobContext;
import com.xxl.job.core.enums.ExecutorBlockStrategyEnum; import com.xxl.job.core.enums.ExecutorBlockStrategyEnum;
import com.xxl.tool.core.StringTool; import com.xxl.tool.core.StringTool;
import com.xxl.tool.exception.ThrowableTool; import com.xxl.tool.exception.ThrowableTool;
@ -178,7 +179,7 @@ public class JobTrigger {
} }
} }
} else { } else {
routeAddressResult = Response.ofFail( I18nUtil.getString("jobconf_trigger_address_empty")); routeAddressResult = Response.of(XxlJobContext.HANDLE_CODE_FAIL, I18nUtil.getString("jobconf_trigger_address_empty"));
} }
// 4、trigger remote executor // 4、trigger remote executor
@ -186,7 +187,7 @@ public class JobTrigger {
if (address != null) { if (address != null) {
triggerResult = doTrigger(triggerParam, address); triggerResult = doTrigger(triggerParam, address);
} else { } else {
triggerResult = Response.ofFail(null); triggerResult = Response.of(XxlJobContext.HANDLE_CODE_FAIL, null);
} }
// 5、collection trigger info // 5、collection trigger info
@ -198,14 +199,15 @@ public class JobTrigger {
triggerMsgSb.append("<br>").append(I18nUtil.getString("jobconf_trigger_exe_regaddress")).append("").append(group.getRegistryList()); triggerMsgSb.append("<br>").append(I18nUtil.getString("jobconf_trigger_exe_regaddress")).append("").append(group.getRegistryList());
triggerMsgSb.append("<br>").append(I18nUtil.getString("jobinfo_field_executorRouteStrategy")).append("").append(executorRouteStrategyEnum.getTitle()); triggerMsgSb.append("<br>").append(I18nUtil.getString("jobinfo_field_executorRouteStrategy")).append("").append(executorRouteStrategyEnum.getTitle());
if (shardingParam != null) { if (shardingParam != null) {
triggerMsgSb.append("("+shardingParam+")"); triggerMsgSb.append("(").append(shardingParam).append(")");
} }
triggerMsgSb.append("<br>").append(I18nUtil.getString("jobinfo_field_executorBlockStrategy")).append("").append(blockStrategy.getTitle()); triggerMsgSb.append("<br>").append(I18nUtil.getString("jobinfo_field_executorBlockStrategy")).append("").append(blockStrategy.getTitle());
triggerMsgSb.append("<br>").append(I18nUtil.getString("jobinfo_field_timeout")).append("").append(jobInfo.getExecutorTimeout()); triggerMsgSb.append("<br>").append(I18nUtil.getString("jobinfo_field_timeout")).append("").append(jobInfo.getExecutorTimeout());
triggerMsgSb.append("<br>").append(I18nUtil.getString("jobinfo_field_executorFailRetryCount")).append("").append(finalFailRetryCount); triggerMsgSb.append("<br>").append(I18nUtil.getString("jobinfo_field_executorFailRetryCount")).append("").append(finalFailRetryCount);
triggerMsgSb.append("<br><br><span style=\"color:#00c0ef;\" > >>>>>>>>>>>"+ I18nUtil.getString("jobconf_trigger_run") +"<<<<<<<<<<< </span><br>") triggerMsgSb.append("<br><br><span style=\"color:#00c0ef;\" > >>>>>>>>>>>").append(I18nUtil.getString("jobconf_trigger_run")).append("<<<<<<<<<<< </span><br>")
.append((routeAddressResult!=null&&routeAddressResult.getMsg()!=null)?routeAddressResult.getMsg()+"<br><br>":"").append(triggerResult.getMsg()!=null?triggerResult.getMsg():""); .append((routeAddressResult!=null&&!routeAddressResult.isSuccess()&&routeAddressResult.getMsg()!=null)?routeAddressResult.getMsg()+"<br><br>":"")
.append((!triggerResult.isSuccess()&triggerResult.getMsg()!=null) ?triggerResult.getMsg():"");
// 6、save log trigger-info // 6、save log trigger-info
jobLog.setExecutorAddress(address); jobLog.setExecutorAddress(address);
@ -235,7 +237,7 @@ public class JobTrigger {
runResult = executorBiz.run(triggerParam); runResult = executorBiz.run(triggerParam);
} catch (Exception e) { } catch (Exception e) {
logger.error(">>>>>>>>>>> xxl-job trigger error, please check if the executor[{}] is running.", address, e); logger.error(">>>>>>>>>>> xxl-job trigger error, please check if the executor[{}] is running.", address, e);
runResult = Response.ofFail(ThrowableTool.toString(e)); runResult = Response.of(XxlJobContext.HANDLE_CODE_FAIL, ThrowableTool.toString(e));
} }
StringBuffer runResultSB = new StringBuffer(I18nUtil.getString("jobconf_trigger_run") + ""); StringBuffer runResultSB = new StringBuffer(I18nUtil.getString("jobconf_trigger_run") + "");

@ -2,8 +2,7 @@ package com.xxl.job.admin.service;
import com.xxl.job.admin.model.XxlJobInfo; import com.xxl.job.admin.model.XxlJobInfo;
import com.xxl.job.admin.model.XxlJobUser; import com.xxl.job.core.openapi.model.ReturnT;
import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.sso.core.model.LoginInfo; import com.xxl.sso.core.model.LoginInfo;
import com.xxl.tool.response.Response; import com.xxl.tool.response.Response;

@ -1,9 +1,9 @@
package com.xxl.job.admin.service.impl; package com.xxl.job.admin.service.impl;
import com.xxl.job.admin.scheduler.config.XxlJobAdminBootstrap; import com.xxl.job.admin.scheduler.config.XxlJobAdminBootstrap;
import com.xxl.job.core.biz.AdminBiz; import com.xxl.job.core.openapi.AdminBiz;
import com.xxl.job.core.biz.model.HandleCallbackRequest; import com.xxl.job.core.openapi.model.HandleCallbackRequest;
import com.xxl.job.core.biz.model.RegistryRequest; import com.xxl.job.core.openapi.model.RegistryRequest;
import com.xxl.tool.response.Response; import com.xxl.tool.response.Response;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;

@ -14,7 +14,7 @@ import com.xxl.job.admin.scheduler.type.ScheduleTypeEnum;
import com.xxl.job.admin.service.XxlJobService; import com.xxl.job.admin.service.XxlJobService;
import com.xxl.job.admin.util.I18nUtil; import com.xxl.job.admin.util.I18nUtil;
import com.xxl.job.admin.util.JobGroupPermissionUtil; import com.xxl.job.admin.util.JobGroupPermissionUtil;
import com.xxl.job.core.biz.model.ReturnT; import com.xxl.job.core.openapi.model.ReturnT;
import com.xxl.job.core.enums.ExecutorBlockStrategyEnum; import com.xxl.job.core.enums.ExecutorBlockStrategyEnum;
import com.xxl.job.core.glue.GlueTypeEnum; import com.xxl.job.core.glue.GlueTypeEnum;
import com.xxl.sso.core.model.LoginInfo; import com.xxl.sso.core.model.LoginInfo;

@ -1,9 +1,9 @@
package com.xxl.job.adminbiz; package com.xxl.job.adminbiz;
import com.xxl.job.core.biz.AdminBiz; import com.xxl.job.core.openapi.AdminBiz;
import com.xxl.job.core.biz.client.AdminBizClient; import com.xxl.job.core.openapi.client.AdminBizClient;
import com.xxl.job.core.biz.model.HandleCallbackRequest; import com.xxl.job.core.openapi.model.HandleCallbackRequest;
import com.xxl.job.core.biz.model.RegistryRequest; import com.xxl.job.core.openapi.model.RegistryRequest;
import com.xxl.job.core.context.XxlJobContext; import com.xxl.job.core.context.XxlJobContext;
import com.xxl.job.core.enums.RegistryConfig; import com.xxl.job.core.enums.RegistryConfig;
import com.xxl.tool.response.Response; import com.xxl.tool.response.Response;

@ -1,8 +1,8 @@
package com.xxl.job.executorbiz; package com.xxl.job.executorbiz;
import com.xxl.job.core.biz.ExecutorBiz; import com.xxl.job.core.openapi.ExecutorBiz;
import com.xxl.job.core.biz.client.ExecutorBizClient; import com.xxl.job.core.openapi.client.ExecutorBizClient;
import com.xxl.job.core.biz.model.*; import com.xxl.job.core.openapi.model.*;
import com.xxl.job.core.enums.ExecutorBlockStrategyEnum; import com.xxl.job.core.enums.ExecutorBlockStrategyEnum;
import com.xxl.job.core.glue.GlueTypeEnum; import com.xxl.job.core.glue.GlueTypeEnum;
import com.xxl.tool.response.Response; import com.xxl.tool.response.Response;

@ -1,7 +1,7 @@
package com.xxl.job.core.executor; package com.xxl.job.core.executor;
import com.xxl.job.core.biz.AdminBiz; import com.xxl.job.core.openapi.AdminBiz;
import com.xxl.job.core.biz.client.AdminBizClient; import com.xxl.job.core.openapi.client.AdminBizClient;
import com.xxl.job.core.handler.IJobHandler; import com.xxl.job.core.handler.IJobHandler;
import com.xxl.job.core.handler.annotation.XxlJob; import com.xxl.job.core.handler.annotation.XxlJob;
import com.xxl.job.core.handler.impl.MethodJobHandler; import com.xxl.job.core.handler.impl.MethodJobHandler;

@ -1,6 +1,6 @@
package com.xxl.job.core.log; package com.xxl.job.core.log;
import com.xxl.job.core.biz.model.LogResult; import com.xxl.job.core.openapi.model.LogResult;
import com.xxl.tool.core.StringTool; import com.xxl.tool.core.StringTool;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;

@ -1,7 +1,7 @@
package com.xxl.job.core.biz; package com.xxl.job.core.openapi;
import com.xxl.job.core.biz.model.HandleCallbackRequest; import com.xxl.job.core.openapi.model.HandleCallbackRequest;
import com.xxl.job.core.biz.model.RegistryRequest; import com.xxl.job.core.openapi.model.RegistryRequest;
import com.xxl.tool.response.Response; import com.xxl.tool.response.Response;
import java.util.List; import java.util.List;

@ -1,6 +1,6 @@
package com.xxl.job.core.biz; package com.xxl.job.core.openapi;
import com.xxl.job.core.biz.model.*; import com.xxl.job.core.openapi.model.*;
import com.xxl.tool.response.Response; import com.xxl.tool.response.Response;
/** /**

@ -1,8 +1,8 @@
package com.xxl.job.core.biz.client; package com.xxl.job.core.openapi.client;
import com.xxl.job.core.biz.AdminBiz; import com.xxl.job.core.openapi.AdminBiz;
import com.xxl.job.core.biz.model.HandleCallbackRequest; import com.xxl.job.core.openapi.model.HandleCallbackRequest;
import com.xxl.job.core.biz.model.RegistryRequest; import com.xxl.job.core.openapi.model.RegistryRequest;
import com.xxl.job.core.util.XxlJobRemotingUtil; import com.xxl.job.core.util.XxlJobRemotingUtil;
import com.xxl.tool.response.Response; import com.xxl.tool.response.Response;

@ -1,7 +1,7 @@
package com.xxl.job.core.biz.client; package com.xxl.job.core.openapi.client;
import com.xxl.job.core.biz.ExecutorBiz; import com.xxl.job.core.openapi.ExecutorBiz;
import com.xxl.job.core.biz.model.*; import com.xxl.job.core.openapi.model.*;
import com.xxl.job.core.util.XxlJobRemotingUtil; import com.xxl.job.core.util.XxlJobRemotingUtil;
import com.xxl.tool.response.Response; import com.xxl.tool.response.Response;

@ -1,7 +1,8 @@
package com.xxl.job.core.biz.impl; package com.xxl.job.core.openapi.impl;
import com.xxl.job.core.biz.ExecutorBiz; import com.xxl.job.core.context.XxlJobContext;
import com.xxl.job.core.biz.model.*; import com.xxl.job.core.openapi.ExecutorBiz;
import com.xxl.job.core.openapi.model.*;
import com.xxl.job.core.enums.ExecutorBlockStrategyEnum; import com.xxl.job.core.enums.ExecutorBlockStrategyEnum;
import com.xxl.job.core.executor.XxlJobExecutor; import com.xxl.job.core.executor.XxlJobExecutor;
import com.xxl.job.core.glue.GlueFactory; import com.xxl.job.core.glue.GlueFactory;
@ -71,7 +72,7 @@ public class ExecutorBizImpl implements ExecutorBiz {
if (jobHandler == null) { if (jobHandler == null) {
jobHandler = newJobHandler; jobHandler = newJobHandler;
if (jobHandler == null) { if (jobHandler == null) {
return Response.ofFail( "job handler [" + triggerRequest.getExecutorHandler() + "] not found."); return Response.of(XxlJobContext.HANDLE_CODE_FAIL, "job handler [" + triggerRequest.getExecutorHandler() + "] not found.");
} }
} }
@ -95,7 +96,7 @@ public class ExecutorBizImpl implements ExecutorBiz {
jobHandler = new GlueJobHandler(originJobHandler, triggerRequest.getGlueUpdatetime()); jobHandler = new GlueJobHandler(originJobHandler, triggerRequest.getGlueUpdatetime());
} catch (Exception e) { } catch (Exception e) {
logger.error(e.getMessage(), e); logger.error(e.getMessage(), e);
return Response.ofFail( e.getMessage()); return Response.of(XxlJobContext.HANDLE_CODE_FAIL, e.getMessage());
} }
} }
} else if (glueTypeEnum!=null && glueTypeEnum.isScript()) { } else if (glueTypeEnum!=null && glueTypeEnum.isScript()) {
@ -116,7 +117,7 @@ public class ExecutorBizImpl implements ExecutorBiz {
jobHandler = new ScriptJobHandler(triggerRequest.getJobId(), triggerRequest.getGlueUpdatetime(), triggerRequest.getGlueSource(), GlueTypeEnum.match(triggerRequest.getGlueType())); jobHandler = new ScriptJobHandler(triggerRequest.getJobId(), triggerRequest.getGlueUpdatetime(), triggerRequest.getGlueSource(), GlueTypeEnum.match(triggerRequest.getGlueType()));
} }
} else { } else {
return Response.ofFail("glueType[" + triggerRequest.getGlueType() + "] is not valid."); return Response.of(XxlJobContext.HANDLE_CODE_FAIL, "glueType[" + triggerRequest.getGlueType() + "] is not valid.");
} }
// executor block strategy // executor block strategy
@ -125,7 +126,7 @@ public class ExecutorBizImpl implements ExecutorBiz {
if (ExecutorBlockStrategyEnum.DISCARD_LATER == blockStrategy) { if (ExecutorBlockStrategyEnum.DISCARD_LATER == blockStrategy) {
// discard when running // discard when running
if (jobThread.isRunningOrHasQueue()) { if (jobThread.isRunningOrHasQueue()) {
return Response.ofFail("block strategy effect"+ExecutorBlockStrategyEnum.DISCARD_LATER.getTitle()); return Response.of(XxlJobContext.HANDLE_CODE_FAIL, "block strategy effect"+ExecutorBlockStrategyEnum.DISCARD_LATER.getTitle());
} }
} else if (ExecutorBlockStrategyEnum.COVER_EARLY == blockStrategy) { } else if (ExecutorBlockStrategyEnum.COVER_EARLY == blockStrategy) {
// kill running jobThread // kill running jobThread
@ -145,8 +146,7 @@ public class ExecutorBizImpl implements ExecutorBiz {
} }
// push data to queue // push data to queue
Response<String> pushResult = jobThread.pushTriggerQueue(triggerRequest); return jobThread.pushTriggerQueue(triggerRequest);
return pushResult;
} }
@Override @Override

@ -1,4 +1,4 @@
package com.xxl.job.core.biz.model; package com.xxl.job.core.openapi.model;
import java.io.Serializable; import java.io.Serializable;

@ -1,4 +1,4 @@
package com.xxl.job.core.biz.model; package com.xxl.job.core.openapi.model;
import java.io.Serializable; import java.io.Serializable;

@ -1,4 +1,4 @@
package com.xxl.job.core.biz.model; package com.xxl.job.core.openapi.model;
import java.io.Serializable; import java.io.Serializable;

@ -1,4 +1,4 @@
package com.xxl.job.core.biz.model; package com.xxl.job.core.openapi.model;
import java.io.Serializable; import java.io.Serializable;

@ -1,4 +1,4 @@
package com.xxl.job.core.biz.model; package com.xxl.job.core.openapi.model;
import java.io.Serializable; import java.io.Serializable;

@ -1,4 +1,4 @@
package com.xxl.job.core.biz.model; package com.xxl.job.core.openapi.model;
import java.io.Serializable; import java.io.Serializable;

@ -1,4 +1,4 @@
package com.xxl.job.core.biz.model; package com.xxl.job.core.openapi.model;
import java.io.Serializable; import java.io.Serializable;

@ -1,4 +1,4 @@
package com.xxl.job.core.biz.model; package com.xxl.job.core.openapi.model;
import java.io.Serializable; import java.io.Serializable;

@ -1,8 +1,8 @@
package com.xxl.job.core.server; package com.xxl.job.core.server;
import com.xxl.job.core.biz.ExecutorBiz; import com.xxl.job.core.openapi.ExecutorBiz;
import com.xxl.job.core.biz.impl.ExecutorBizImpl; import com.xxl.job.core.openapi.impl.ExecutorBizImpl;
import com.xxl.job.core.biz.model.*; import com.xxl.job.core.openapi.model.*;
import com.xxl.job.core.thread.ExecutorRegistryThread; import com.xxl.job.core.thread.ExecutorRegistryThread;
import com.xxl.job.core.util.XxlJobRemotingUtil; import com.xxl.job.core.util.XxlJobRemotingUtil;
import com.xxl.tool.exception.ThrowableTool; import com.xxl.tool.exception.ThrowableTool;

@ -1,7 +1,7 @@
package com.xxl.job.core.thread; package com.xxl.job.core.thread;
import com.xxl.job.core.biz.AdminBiz; import com.xxl.job.core.openapi.AdminBiz;
import com.xxl.job.core.biz.model.RegistryRequest; import com.xxl.job.core.openapi.model.RegistryRequest;
import com.xxl.job.core.enums.RegistryConfig; import com.xxl.job.core.enums.RegistryConfig;
import com.xxl.job.core.executor.XxlJobExecutor; import com.xxl.job.core.executor.XxlJobExecutor;
import com.xxl.tool.response.Response; import com.xxl.tool.response.Response;

@ -1,7 +1,7 @@
package com.xxl.job.core.thread; package com.xxl.job.core.thread;
import com.xxl.job.core.biz.model.HandleCallbackRequest; import com.xxl.job.core.openapi.model.HandleCallbackRequest;
import com.xxl.job.core.biz.model.TriggerRequest; import com.xxl.job.core.openapi.model.TriggerRequest;
import com.xxl.job.core.context.XxlJobContext; import com.xxl.job.core.context.XxlJobContext;
import com.xxl.job.core.context.XxlJobHelper; import com.xxl.job.core.context.XxlJobHelper;
import com.xxl.job.core.executor.XxlJobExecutor; import com.xxl.job.core.executor.XxlJobExecutor;
@ -61,7 +61,7 @@ public class JobThread extends Thread{
// avoid repeat // avoid repeat
if (!triggerLogIdSet.add(triggerParam.getLogId())) { if (!triggerLogIdSet.add(triggerParam.getLogId())) {
logger.info(">>>>>>>>>>> repeate trigger job, logId:{}", triggerParam.getLogId()); logger.info(">>>>>>>>>>> repeate trigger job, logId:{}", triggerParam.getLogId());
return Response.ofFail("repeate trigger job, logId:" + triggerParam.getLogId()); return Response.of(XxlJobContext.HANDLE_CODE_FAIL, "repeate trigger job, logId:" + triggerParam.getLogId());
} }
// push trigger queue // push trigger queue

@ -1,7 +1,7 @@
package com.xxl.job.core.thread; package com.xxl.job.core.thread;
import com.xxl.job.core.biz.AdminBiz; import com.xxl.job.core.openapi.AdminBiz;
import com.xxl.job.core.biz.model.HandleCallbackRequest; import com.xxl.job.core.openapi.model.HandleCallbackRequest;
import com.xxl.job.core.context.XxlJobContext; import com.xxl.job.core.context.XxlJobContext;
import com.xxl.job.core.context.XxlJobHelper; import com.xxl.job.core.context.XxlJobHelper;
import com.xxl.job.core.enums.RegistryConfig; import com.xxl.job.core.enums.RegistryConfig;

Loading…
Cancel
Save