refactor(core): 重构参数模型类名为请求模型类名数类型

3.3.0-release
xuxueli 1 month ago
parent 760b21ef50
commit 2152fc1563

@ -11,8 +11,8 @@ import com.xxl.job.admin.scheduler.exception.XxlJobException;
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.ExecutorBiz; import com.xxl.job.core.biz.ExecutorBiz;
import com.xxl.job.core.biz.model.KillParam; import com.xxl.job.core.biz.model.KillRequest;
import com.xxl.job.core.biz.model.LogParam; import com.xxl.job.core.biz.model.LogRequest;
import com.xxl.job.core.biz.model.LogResult; import com.xxl.job.core.biz.model.LogResult;
import com.xxl.job.core.biz.model.ReturnT; import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.tool.core.CollectionTool; import com.xxl.tool.core.CollectionTool;
@ -169,7 +169,7 @@ public class JobLogController {
// log cat // log cat
ExecutorBiz executorBiz = XxlJobAdminBootstrap.getExecutorBiz(jobLog.getExecutorAddress()); ExecutorBiz executorBiz = XxlJobAdminBootstrap.getExecutorBiz(jobLog.getExecutorAddress());
ReturnT<LogResult> logResult = executorBiz.log(new LogParam(jobLog.getTriggerTime().getTime(), logId, fromLineNum)); ReturnT<LogResult> logResult = executorBiz.log(new LogRequest(jobLog.getTriggerTime().getTime(), logId, fromLineNum));
// is end // is end
if (logResult.getContent()!=null && logResult.getContent().getFromLineNum() > logResult.getContent().getToLineNum()) { if (logResult.getContent()!=null && logResult.getContent().getFromLineNum() > logResult.getContent().getToLineNum()) {
@ -243,7 +243,7 @@ public class JobLogController {
ReturnT<String> runResult = null; ReturnT<String> runResult = null;
try { try {
ExecutorBiz executorBiz = XxlJobAdminBootstrap.getExecutorBiz(log.getExecutorAddress()); ExecutorBiz executorBiz = XxlJobAdminBootstrap.getExecutorBiz(log.getExecutorAddress());
runResult = executorBiz.kill(new KillParam(jobInfo.getId())); runResult = executorBiz.kill(new KillRequest(jobInfo.getId()));
} catch (Exception e) { } catch (Exception e) {
logger.error(e.getMessage(), e); logger.error(e.getMessage(), e);
runResult = ReturnT.ofFail( e.getMessage()); runResult = ReturnT.ofFail( e.getMessage());

@ -2,8 +2,8 @@ package com.xxl.job.admin.controller.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.biz.AdminBiz;
import com.xxl.job.core.biz.model.HandleCallbackParam; import com.xxl.job.core.biz.model.HandleCallbackRequest;
import com.xxl.job.core.biz.model.RegistryParam; import com.xxl.job.core.biz.model.RegistryRequest;
import com.xxl.job.core.biz.model.ReturnT; import com.xxl.job.core.biz.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;
@ -55,13 +55,13 @@ public class JobApiController {
// services mapping // services mapping
if ("callback".equals(uri)) { if ("callback".equals(uri)) {
List<HandleCallbackParam> callbackParamList = GsonTool.fromJson(data, List.class, HandleCallbackParam.class); List<HandleCallbackRequest> callbackParamList = GsonTool.fromJson(data, List.class, HandleCallbackRequest.class);
return adminBiz.callback(callbackParamList); return adminBiz.callback(callbackParamList);
} else if ("registry".equals(uri)) { } else if ("registry".equals(uri)) {
RegistryParam registryParam = GsonTool.fromJson(data, RegistryParam.class); RegistryRequest registryParam = GsonTool.fromJson(data, RegistryRequest.class);
return adminBiz.registry(registryParam); return adminBiz.registry(registryParam);
} else if ("registryRemove".equals(uri)) { } else if ("registryRemove".equals(uri)) {
RegistryParam registryParam = GsonTool.fromJson(data, RegistryParam.class); RegistryRequest registryParam = GsonTool.fromJson(data, RegistryRequest.class);
return adminBiz.registryRemove(registryParam); return adminBiz.registryRemove(registryParam);
} else { } else {
return ReturnT.ofFail("invalid request, uri-mapping("+ uri +") not found."); return ReturnT.ofFail("invalid request, uri-mapping("+ uri +") not found.");

@ -1,7 +1,7 @@
package com.xxl.job.admin.scheduler.route; package com.xxl.job.admin.scheduler.route;
import com.xxl.job.core.biz.model.ReturnT; import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.biz.model.TriggerParam; import com.xxl.job.core.biz.model.TriggerRequest;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -19,6 +19,6 @@ public abstract class ExecutorRouter {
* @param addressList executor address list * @param addressList executor address list
* @return ReturnT.content=address * @return ReturnT.content=address
*/ */
public abstract ReturnT<String> route(TriggerParam triggerParam, List<String> addressList); public abstract ReturnT<String> route(TriggerRequest triggerParam, List<String> addressList);
} }

@ -4,9 +4,9 @@ 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.biz.ExecutorBiz;
import com.xxl.job.core.biz.model.IdleBeatParam; import com.xxl.job.core.biz.model.IdleBeatRequest;
import com.xxl.job.core.biz.model.ReturnT; import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.biz.model.TriggerParam; import com.xxl.job.core.biz.model.TriggerRequest;
import java.util.List; import java.util.List;
@ -16,14 +16,14 @@ import java.util.List;
public class ExecutorRouteBusyover extends ExecutorRouter { public class ExecutorRouteBusyover extends ExecutorRouter {
@Override @Override
public ReturnT<String> route(TriggerParam triggerParam, List<String> addressList) { public ReturnT<String> route(TriggerRequest triggerParam, List<String> addressList) {
StringBuffer idleBeatResultSB = new StringBuffer(); StringBuffer idleBeatResultSB = new StringBuffer();
for (String address : addressList) { for (String address : addressList) {
// beat // beat
ReturnT<String> idleBeatResult = null; ReturnT<String> idleBeatResult = null;
try { try {
ExecutorBiz executorBiz = XxlJobAdminBootstrap.getExecutorBiz(address); ExecutorBiz executorBiz = XxlJobAdminBootstrap.getExecutorBiz(address);
idleBeatResult = executorBiz.idleBeat(new IdleBeatParam(triggerParam.getJobId())); idleBeatResult = executorBiz.idleBeat(new IdleBeatRequest(triggerParam.getJobId()));
} catch (Exception e) { } catch (Exception e) {
logger.error(e.getMessage(), e); logger.error(e.getMessage(), e);
idleBeatResult = ReturnT.ofFail( ""+e ); idleBeatResult = ReturnT.ofFail( ""+e );

@ -2,7 +2,7 @@ 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.ReturnT; import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.biz.model.TriggerParam; import com.xxl.job.core.biz.model.TriggerRequest;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.security.MessageDigest; import java.security.MessageDigest;
@ -81,7 +81,7 @@ public class ExecutorRouteConsistentHash extends ExecutorRouter {
} }
@Override @Override
public ReturnT<String> route(TriggerParam triggerParam, List<String> addressList) { public ReturnT<String> route(TriggerRequest triggerParam, List<String> addressList) {
String address = hashJob(triggerParam.getJobId(), addressList); String address = hashJob(triggerParam.getJobId(), addressList);
return ReturnT.ofSuccess(address); return ReturnT.ofSuccess(address);
} }

@ -5,7 +5,7 @@ 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.biz.ExecutorBiz;
import com.xxl.job.core.biz.model.ReturnT; import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.biz.model.TriggerParam; import com.xxl.job.core.biz.model.TriggerRequest;
import java.util.List; import java.util.List;
@ -15,7 +15,7 @@ import java.util.List;
public class ExecutorRouteFailover extends ExecutorRouter { public class ExecutorRouteFailover extends ExecutorRouter {
@Override @Override
public ReturnT<String> route(TriggerParam triggerParam, List<String> addressList) { public ReturnT<String> route(TriggerRequest triggerParam, List<String> addressList) {
StringBuffer beatResultSB = new StringBuffer(); StringBuffer beatResultSB = new StringBuffer();
for (String address : addressList) { for (String address : addressList) {

@ -2,7 +2,7 @@ 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.ReturnT; import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.biz.model.TriggerParam; import com.xxl.job.core.biz.model.TriggerRequest;
import java.util.List; import java.util.List;
@ -12,7 +12,7 @@ import java.util.List;
public class ExecutorRouteFirst extends ExecutorRouter { public class ExecutorRouteFirst extends ExecutorRouter {
@Override @Override
public ReturnT<String> route(TriggerParam triggerParam, List<String> addressList){ public ReturnT<String> route(TriggerRequest triggerParam, List<String> addressList){
return ReturnT.ofSuccess(addressList.get(0)); return ReturnT.ofSuccess(addressList.get(0));
} }

@ -2,7 +2,7 @@ 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.ReturnT; import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.biz.model.TriggerParam; import com.xxl.job.core.biz.model.TriggerRequest;
import java.util.*; import java.util.*;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
@ -70,7 +70,7 @@ public class ExecutorRouteLFU extends ExecutorRouter {
} }
@Override @Override
public ReturnT<String> route(TriggerParam triggerParam, List<String> addressList) { public ReturnT<String> route(TriggerRequest triggerParam, List<String> addressList) {
String address = route(triggerParam.getJobId(), addressList); String address = route(triggerParam.getJobId(), addressList);
return ReturnT.ofSuccess(address); return ReturnT.ofSuccess(address);
} }

@ -2,7 +2,7 @@ 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.ReturnT; import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.biz.model.TriggerParam; import com.xxl.job.core.biz.model.TriggerRequest;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
@ -72,7 +72,7 @@ public class ExecutorRouteLRU extends ExecutorRouter {
} }
@Override @Override
public ReturnT<String> route(TriggerParam triggerParam, List<String> addressList) { public ReturnT<String> route(TriggerRequest triggerParam, List<String> addressList) {
String address = route(triggerParam.getJobId(), addressList); String address = route(triggerParam.getJobId(), addressList);
return ReturnT.ofSuccess(address); return ReturnT.ofSuccess(address);
} }

@ -2,7 +2,7 @@ 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.ReturnT; import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.biz.model.TriggerParam; import com.xxl.job.core.biz.model.TriggerRequest;
import java.util.List; import java.util.List;
@ -12,7 +12,7 @@ import java.util.List;
public class ExecutorRouteLast extends ExecutorRouter { public class ExecutorRouteLast extends ExecutorRouter {
@Override @Override
public ReturnT<String> route(TriggerParam triggerParam, List<String> addressList) { public ReturnT<String> route(TriggerRequest triggerParam, List<String> addressList) {
return ReturnT.ofSuccess(addressList.get(addressList.size()-1)); return ReturnT.ofSuccess(addressList.get(addressList.size()-1));
} }

@ -2,7 +2,7 @@ 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.ReturnT; import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.biz.model.TriggerParam; import com.xxl.job.core.biz.model.TriggerRequest;
import java.util.List; import java.util.List;
import java.util.Random; import java.util.Random;
@ -15,7 +15,7 @@ public class ExecutorRouteRandom extends ExecutorRouter {
private static Random localRandom = new Random(); private static Random localRandom = new Random();
@Override @Override
public ReturnT<String> route(TriggerParam triggerParam, List<String> addressList) { public ReturnT<String> route(TriggerRequest triggerParam, List<String> addressList) {
String address = addressList.get(localRandom.nextInt(addressList.size())); String address = addressList.get(localRandom.nextInt(addressList.size()));
return ReturnT.ofSuccess(address); return ReturnT.ofSuccess(address);
} }

@ -2,7 +2,7 @@ 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.ReturnT; import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.biz.model.TriggerParam; import com.xxl.job.core.biz.model.TriggerRequest;
import java.util.List; import java.util.List;
import java.util.Random; import java.util.Random;
@ -38,7 +38,7 @@ public class ExecutorRouteRound extends ExecutorRouter {
} }
@Override @Override
public ReturnT<String> route(TriggerParam triggerParam, List<String> addressList) { public ReturnT<String> route(TriggerRequest triggerParam, List<String> addressList) {
String address = addressList.get(count(triggerParam.getJobId())%addressList.size()); String address = addressList.get(count(triggerParam.getJobId())%addressList.size());
return ReturnT.ofSuccess(address); return ReturnT.ofSuccess(address);
} }

@ -3,7 +3,7 @@ package com.xxl.job.admin.scheduler.thread;
import com.xxl.job.admin.model.XxlJobLog; 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.util.I18nUtil; import com.xxl.job.admin.util.I18nUtil;
import com.xxl.job.core.biz.model.HandleCallbackParam; import com.xxl.job.core.biz.model.HandleCallbackRequest;
import com.xxl.job.core.biz.model.ReturnT; import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.tool.core.DateTool; import com.xxl.tool.core.DateTool;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -136,12 +136,12 @@ public class JobCompleteHelper {
// ---------------------- helper ---------------------- // ---------------------- helper ----------------------
public ReturnT<String> callback(List<HandleCallbackParam> callbackParamList) { public ReturnT<String> callback(List<HandleCallbackRequest> callbackParamList) {
callbackThreadPool.execute(new Runnable() { callbackThreadPool.execute(new Runnable() {
@Override @Override
public void run() { public void run() {
for (HandleCallbackParam handleCallbackParam: callbackParamList) { for (HandleCallbackRequest handleCallbackParam: callbackParamList) {
ReturnT<String> callbackResult = callback(handleCallbackParam); ReturnT<String> callbackResult = callback(handleCallbackParam);
logger.debug(">>>>>>>>> JobApiController.callback {}, handleCallbackParam={}, callbackResult={}", logger.debug(">>>>>>>>> JobApiController.callback {}, handleCallbackParam={}, callbackResult={}",
(callbackResult.isSuccess()?"success":"fail"), handleCallbackParam, callbackResult); (callbackResult.isSuccess()?"success":"fail"), handleCallbackParam, callbackResult);
@ -152,7 +152,7 @@ public class JobCompleteHelper {
return ReturnT.ofSuccess(); return ReturnT.ofSuccess();
} }
private ReturnT<String> callback(HandleCallbackParam handleCallbackParam) { private ReturnT<String> callback(HandleCallbackRequest handleCallbackParam) {
// valid log item // valid log item
XxlJobLog log = XxlJobAdminBootstrap.getInstance().getXxlJobLogMapper().load(handleCallbackParam.getLogId()); XxlJobLog log = XxlJobAdminBootstrap.getInstance().getXxlJobLogMapper().load(handleCallbackParam.getLogId());
if (log == null) { if (log == null) {

@ -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.RegistryParam; import com.xxl.job.core.biz.model.RegistryRequest;
import com.xxl.job.core.biz.model.ReturnT; import com.xxl.job.core.biz.model.ReturnT;
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;
@ -154,7 +154,7 @@ public class JobRegistryHelper {
/** /**
* registry * registry
*/ */
public ReturnT<String> registry(RegistryParam registryParam) { public ReturnT<String> registry(RegistryRequest registryParam) {
// valid // valid
if (StringTool.isBlank(registryParam.getRegistryGroup()) if (StringTool.isBlank(registryParam.getRegistryGroup())
@ -189,7 +189,7 @@ public class JobRegistryHelper {
/** /**
* registry remove * registry remove
*/ */
public ReturnT<String> registryRemove(RegistryParam registryParam) { public ReturnT<String> registryRemove(RegistryRequest registryParam) {
// valid // valid
if (StringTool.isBlank(registryParam.getRegistryGroup()) if (StringTool.isBlank(registryParam.getRegistryGroup())
@ -213,7 +213,7 @@ public class JobRegistryHelper {
return ReturnT.ofSuccess(); return ReturnT.ofSuccess();
} }
private void freshGroupRegistryInfo(RegistryParam registryParam){ private void freshGroupRegistryInfo(RegistryRequest registryParam){
// Under consideration, prevent affecting core tables // Under consideration, prevent affecting core tables
} }

@ -11,7 +11,7 @@ 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.biz.ExecutorBiz;
import com.xxl.job.core.biz.model.ReturnT; import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.biz.model.TriggerParam; import com.xxl.job.core.biz.model.TriggerRequest;
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;
@ -147,7 +147,7 @@ public class JobTrigger {
logger.debug(">>>>>>>>>>> xxl-job trigger start, jobId:{}", jobLog.getId()); logger.debug(">>>>>>>>>>> xxl-job trigger start, jobId:{}", jobLog.getId());
// 2、init trigger-param // 2、init trigger-param
TriggerParam triggerParam = new TriggerParam(); TriggerRequest triggerParam = new TriggerRequest();
triggerParam.setJobId(jobInfo.getId()); triggerParam.setJobId(jobInfo.getId());
triggerParam.setExecutorHandler(jobInfo.getExecutorHandler()); triggerParam.setExecutorHandler(jobInfo.getExecutorHandler());
triggerParam.setExecutorParams(jobInfo.getExecutorParam()); triggerParam.setExecutorParams(jobInfo.getExecutorParam());
@ -228,7 +228,7 @@ public class JobTrigger {
* @param address the address * @param address the address
* @return return * @return return
*/ */
private ReturnT<String> doTrigger(TriggerParam triggerParam, String address){ private ReturnT<String> doTrigger(TriggerRequest triggerParam, String address){
ReturnT<String> runResult = null; ReturnT<String> runResult = null;
try { try {
ExecutorBiz executorBiz = XxlJobAdminBootstrap.getExecutorBiz(address); ExecutorBiz executorBiz = XxlJobAdminBootstrap.getExecutorBiz(address);

@ -2,8 +2,8 @@ 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.biz.AdminBiz;
import com.xxl.job.core.biz.model.HandleCallbackParam; import com.xxl.job.core.biz.model.HandleCallbackRequest;
import com.xxl.job.core.biz.model.RegistryParam; import com.xxl.job.core.biz.model.RegistryRequest;
import com.xxl.job.core.biz.model.ReturnT; import com.xxl.job.core.biz.model.ReturnT;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -17,18 +17,18 @@ public class AdminBizImpl implements AdminBiz {
@Override @Override
public ReturnT<String> callback(List<HandleCallbackParam> callbackParamList) { public ReturnT<String> callback(List<HandleCallbackRequest> handleCallbackRequestList) {
return XxlJobAdminBootstrap.getInstance().getJobCompleteHelper().callback(callbackParamList); return XxlJobAdminBootstrap.getInstance().getJobCompleteHelper().callback(handleCallbackRequestList);
} }
@Override @Override
public ReturnT<String> registry(RegistryParam registryParam) { public ReturnT<String> registry(RegistryRequest registryRequest) {
return XxlJobAdminBootstrap.getInstance().getJobRegistryHelper().registry(registryParam); return XxlJobAdminBootstrap.getInstance().getJobRegistryHelper().registry(registryRequest);
} }
@Override @Override
public ReturnT<String> registryRemove(RegistryParam registryParam) { public ReturnT<String> registryRemove(RegistryRequest registryRequest) {
return XxlJobAdminBootstrap.getInstance().getJobRegistryHelper().registryRemove(registryParam); return XxlJobAdminBootstrap.getInstance().getJobRegistryHelper().registryRemove(registryRequest);
} }
} }

@ -2,8 +2,8 @@ package com.xxl.job.adminbiz;
import com.xxl.job.core.biz.AdminBiz; import com.xxl.job.core.biz.AdminBiz;
import com.xxl.job.core.biz.client.AdminBizClient; import com.xxl.job.core.biz.client.AdminBizClient;
import com.xxl.job.core.biz.model.HandleCallbackParam; import com.xxl.job.core.biz.model.HandleCallbackRequest;
import com.xxl.job.core.biz.model.RegistryParam; import com.xxl.job.core.biz.model.RegistryRequest;
import com.xxl.job.core.biz.model.ReturnT; import com.xxl.job.core.biz.model.ReturnT;
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;
@ -31,11 +31,11 @@ public class AdminBizTest {
public void callback() throws Exception { public void callback() throws Exception {
AdminBiz adminBiz = new AdminBizClient(addressUrl, accessToken, timeoutSecond); AdminBiz adminBiz = new AdminBizClient(addressUrl, accessToken, timeoutSecond);
HandleCallbackParam param = new HandleCallbackParam(); HandleCallbackRequest param = new HandleCallbackRequest();
param.setLogId(1); param.setLogId(1);
param.setHandleCode(XxlJobContext.HANDLE_CODE_SUCCESS); param.setHandleCode(XxlJobContext.HANDLE_CODE_SUCCESS);
List<HandleCallbackParam> callbackParamList = Arrays.asList(param); List<HandleCallbackRequest> callbackParamList = Arrays.asList(param);
ReturnT<String> returnT = adminBiz.callback(callbackParamList); ReturnT<String> returnT = adminBiz.callback(callbackParamList);
@ -51,7 +51,7 @@ public class AdminBizTest {
public void registry() throws Exception { public void registry() throws Exception {
AdminBiz adminBiz = new AdminBizClient(addressUrl, accessToken, timeoutSecond); AdminBiz adminBiz = new AdminBizClient(addressUrl, accessToken, timeoutSecond);
RegistryParam registryParam = new RegistryParam(RegistryConfig.RegistType.EXECUTOR.name(), "xxl-job-executor-example", "127.0.0.1:9999"); RegistryRequest registryParam = new RegistryRequest(RegistryConfig.RegistType.EXECUTOR.name(), "xxl-job-executor-example", "127.0.0.1:9999");
ReturnT<String> returnT = adminBiz.registry(registryParam); ReturnT<String> returnT = adminBiz.registry(registryParam);
assertTrue(returnT.isSuccess()); assertTrue(returnT.isSuccess());
@ -66,7 +66,7 @@ public class AdminBizTest {
public void registryRemove() throws Exception { public void registryRemove() throws Exception {
AdminBiz adminBiz = new AdminBizClient(addressUrl, accessToken, timeoutSecond); AdminBiz adminBiz = new AdminBizClient(addressUrl, accessToken, timeoutSecond);
RegistryParam registryParam = new RegistryParam(RegistryConfig.RegistType.EXECUTOR.name(), "xxl-job-executor-example", "127.0.0.1:9999"); RegistryRequest registryParam = new RegistryRequest(RegistryConfig.RegistType.EXECUTOR.name(), "xxl-job-executor-example", "127.0.0.1:9999");
ReturnT<String> returnT = adminBiz.registryRemove(registryParam); ReturnT<String> returnT = adminBiz.registryRemove(registryParam);
assertTrue(returnT.isSuccess()); assertTrue(returnT.isSuccess());

@ -40,7 +40,7 @@ public class ExecutorBizTest {
final int jobId = 0; final int jobId = 0;
// Act // Act
final ReturnT<String> retval = executorBiz.idleBeat(new IdleBeatParam(jobId)); final ReturnT<String> retval = executorBiz.idleBeat(new IdleBeatRequest(jobId));
// Assert result // Assert result
Assertions.assertNotNull(retval); Assertions.assertNotNull(retval);
@ -54,7 +54,7 @@ public class ExecutorBizTest {
ExecutorBiz executorBiz = new ExecutorBizClient(addressUrl, accessToken, timeout); ExecutorBiz executorBiz = new ExecutorBizClient(addressUrl, accessToken, timeout);
// trigger data // trigger data
final TriggerParam triggerParam = new TriggerParam(); final TriggerRequest triggerParam = new TriggerRequest();
triggerParam.setJobId(1); triggerParam.setJobId(1);
triggerParam.setExecutorHandler("demoJobHandler"); triggerParam.setExecutorHandler("demoJobHandler");
triggerParam.setExecutorParams(null); triggerParam.setExecutorParams(null);
@ -80,7 +80,7 @@ public class ExecutorBizTest {
final int jobId = 0; final int jobId = 0;
// Act // Act
final ReturnT<String> retval = executorBiz.kill(new KillParam(jobId)); final ReturnT<String> retval = executorBiz.kill(new KillRequest(jobId));
// Assert result // Assert result
Assertions.assertNotNull(retval); Assertions.assertNotNull(retval);
@ -98,7 +98,7 @@ public class ExecutorBizTest {
final int fromLineNum = 0; final int fromLineNum = 0;
// Act // Act
final ReturnT<LogResult> retval = executorBiz.log(new LogParam(logDateTim, logId, fromLineNum)); final ReturnT<LogResult> retval = executorBiz.log(new LogRequest(logDateTim, logId, fromLineNum));
// Assert result // Assert result
Assertions.assertNotNull(retval); Assertions.assertNotNull(retval);

@ -1,7 +1,7 @@
package com.xxl.job.core.biz; package com.xxl.job.core.biz;
import com.xxl.job.core.biz.model.HandleCallbackParam; import com.xxl.job.core.biz.model.HandleCallbackRequest;
import com.xxl.job.core.biz.model.RegistryParam; import com.xxl.job.core.biz.model.RegistryRequest;
import com.xxl.job.core.biz.model.ReturnT; import com.xxl.job.core.biz.model.ReturnT;
import java.util.List; import java.util.List;
@ -17,10 +17,10 @@ public interface AdminBiz {
/** /**
* callback * callback
* *
* @param callbackParamList * @param handleCallbackRequestList
* @return * @return
*/ */
public ReturnT<String> callback(List<HandleCallbackParam> callbackParamList); public ReturnT<String> callback(List<HandleCallbackRequest> handleCallbackRequestList);
// ---------------------- registry ---------------------- // ---------------------- registry ----------------------
@ -28,18 +28,18 @@ public interface AdminBiz {
/** /**
* registry * registry
* *
* @param registryParam * @param registryRequest
* @return * @return
*/ */
public ReturnT<String> registry(RegistryParam registryParam); public ReturnT<String> registry(RegistryRequest registryRequest);
/** /**
* registry remove * registry remove
* *
* @param registryParam * @param registryRequest
* @return * @return
*/ */
public ReturnT<String> registryRemove(RegistryParam registryParam); public ReturnT<String> registryRemove(RegistryRequest registryRequest);
// ---------------------- biz (custome) ---------------------- // ---------------------- biz (custome) ----------------------

@ -16,30 +16,30 @@ public interface ExecutorBiz {
/** /**
* idle beat * idle beat
* *
* @param idleBeatParam * @param idleBeatRequest
* @return * @return
*/ */
public ReturnT<String> idleBeat(IdleBeatParam idleBeatParam); public ReturnT<String> idleBeat(IdleBeatRequest idleBeatRequest);
/** /**
* run * run
* @param triggerParam * @param triggerRequest
* @return * @return
*/ */
public ReturnT<String> run(TriggerParam triggerParam); public ReturnT<String> run(TriggerRequest triggerRequest);
/** /**
* kill * kill
* @param killParam * @param killRequest
* @return * @return
*/ */
public ReturnT<String> kill(KillParam killParam); public ReturnT<String> kill(KillRequest killRequest);
/** /**
* log * log
* @param logParam * @param logRequest
* @return * @return
*/ */
public ReturnT<LogResult> log(LogParam logParam); public ReturnT<LogResult> log(LogRequest logRequest);
} }

@ -1,8 +1,8 @@
package com.xxl.job.core.biz.client; package com.xxl.job.core.biz.client;
import com.xxl.job.core.biz.AdminBiz; import com.xxl.job.core.biz.AdminBiz;
import com.xxl.job.core.biz.model.HandleCallbackParam; import com.xxl.job.core.biz.model.HandleCallbackRequest;
import com.xxl.job.core.biz.model.RegistryParam; import com.xxl.job.core.biz.model.RegistryRequest;
import com.xxl.job.core.biz.model.ReturnT; import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.util.XxlJobRemotingUtil; import com.xxl.job.core.util.XxlJobRemotingUtil;
@ -37,18 +37,18 @@ public class AdminBizClient implements AdminBiz {
@Override @Override
public ReturnT<String> callback(List<HandleCallbackParam> callbackParamList) { public ReturnT<String> callback(List<HandleCallbackRequest> handleCallbackRequestList) {
return XxlJobRemotingUtil.postBody(addressUrl+"api/callback", accessToken, timeout, callbackParamList, String.class); return XxlJobRemotingUtil.postBody(addressUrl+"api/callback", accessToken, timeout, handleCallbackRequestList, String.class);
} }
@Override @Override
public ReturnT<String> registry(RegistryParam registryParam) { public ReturnT<String> registry(RegistryRequest registryRequest) {
return XxlJobRemotingUtil.postBody(addressUrl + "api/registry", accessToken, timeout, registryParam, String.class); return XxlJobRemotingUtil.postBody(addressUrl + "api/registry", accessToken, timeout, registryRequest, String.class);
} }
@Override @Override
public ReturnT<String> registryRemove(RegistryParam registryParam) { public ReturnT<String> registryRemove(RegistryRequest registryRequest) {
return XxlJobRemotingUtil.postBody(addressUrl + "api/registryRemove", accessToken, timeout, registryParam, String.class); return XxlJobRemotingUtil.postBody(addressUrl + "api/registryRemove", accessToken, timeout, registryRequest, String.class);
} }
} }

@ -38,23 +38,23 @@ public class ExecutorBizClient implements ExecutorBiz {
} }
@Override @Override
public ReturnT<String> idleBeat(IdleBeatParam idleBeatParam){ public ReturnT<String> idleBeat(IdleBeatRequest idleBeatRequest){
return XxlJobRemotingUtil.postBody(addressUrl+"idleBeat", accessToken, timeout, idleBeatParam, String.class); return XxlJobRemotingUtil.postBody(addressUrl+"idleBeat", accessToken, timeout, idleBeatRequest, String.class);
} }
@Override @Override
public ReturnT<String> run(TriggerParam triggerParam) { public ReturnT<String> run(TriggerRequest triggerRequest) {
return XxlJobRemotingUtil.postBody(addressUrl + "run", accessToken, timeout, triggerParam, String.class); return XxlJobRemotingUtil.postBody(addressUrl + "run", accessToken, timeout, triggerRequest, String.class);
} }
@Override @Override
public ReturnT<String> kill(KillParam killParam) { public ReturnT<String> kill(KillRequest killRequest) {
return XxlJobRemotingUtil.postBody(addressUrl + "kill", accessToken, timeout, killParam, String.class); return XxlJobRemotingUtil.postBody(addressUrl + "kill", accessToken, timeout, killRequest, String.class);
} }
@Override @Override
public ReturnT<LogResult> log(LogParam logParam) { public ReturnT<LogResult> log(LogRequest logRequest) {
return XxlJobRemotingUtil.postBody(addressUrl + "log", accessToken, timeout, logParam, LogResult.class); return XxlJobRemotingUtil.postBody(addressUrl + "log", accessToken, timeout, logRequest, LogResult.class);
} }
} }

@ -28,11 +28,11 @@ public class ExecutorBizImpl implements ExecutorBiz {
} }
@Override @Override
public ReturnT<String> idleBeat(IdleBeatParam idleBeatParam) { public ReturnT<String> idleBeat(IdleBeatRequest idleBeatRequest) {
// isRunningOrHasQueue // isRunningOrHasQueue
boolean isRunningOrHasQueue = false; boolean isRunningOrHasQueue = false;
JobThread jobThread = XxlJobExecutor.loadJobThread(idleBeatParam.getJobId()); JobThread jobThread = XxlJobExecutor.loadJobThread(idleBeatRequest.getJobId());
if (jobThread != null && jobThread.isRunningOrHasQueue()) { if (jobThread != null && jobThread.isRunningOrHasQueue()) {
isRunningOrHasQueue = true; isRunningOrHasQueue = true;
} }
@ -44,18 +44,18 @@ public class ExecutorBizImpl implements ExecutorBiz {
} }
@Override @Override
public ReturnT<String> run(TriggerParam triggerParam) { public ReturnT<String> run(TriggerRequest triggerRequest) {
// load oldjobHandler + jobThread // load oldjobHandler + jobThread
JobThread jobThread = XxlJobExecutor.loadJobThread(triggerParam.getJobId()); JobThread jobThread = XxlJobExecutor.loadJobThread(triggerRequest.getJobId());
IJobHandler jobHandler = jobThread!=null?jobThread.getHandler():null; IJobHandler jobHandler = jobThread!=null?jobThread.getHandler():null;
String removeOldReason = null; String removeOldReason = null;
// validjobHandler + jobThread // validjobHandler + jobThread
GlueTypeEnum glueTypeEnum = GlueTypeEnum.match(triggerParam.getGlueType()); GlueTypeEnum glueTypeEnum = GlueTypeEnum.match(triggerRequest.getGlueType());
if (GlueTypeEnum.BEAN == glueTypeEnum) { if (GlueTypeEnum.BEAN == glueTypeEnum) {
// new jobhandler // new jobhandler
IJobHandler newJobHandler = XxlJobExecutor.loadJobHandler(triggerParam.getExecutorHandler()); IJobHandler newJobHandler = XxlJobExecutor.loadJobHandler(triggerRequest.getExecutorHandler());
// valid old jobThread // valid old jobThread
if (jobThread!=null && jobHandler != newJobHandler) { if (jobThread!=null && jobHandler != newJobHandler) {
@ -70,7 +70,7 @@ public class ExecutorBizImpl implements ExecutorBiz {
if (jobHandler == null) { if (jobHandler == null) {
jobHandler = newJobHandler; jobHandler = newJobHandler;
if (jobHandler == null) { if (jobHandler == null) {
return ReturnT.ofFail( "job handler [" + triggerParam.getExecutorHandler() + "] not found."); return ReturnT.ofFail( "job handler [" + triggerRequest.getExecutorHandler() + "] not found.");
} }
} }
@ -79,7 +79,7 @@ public class ExecutorBizImpl implements ExecutorBiz {
// valid old jobThread // valid old jobThread
if (jobThread != null && if (jobThread != null &&
!(jobThread.getHandler() instanceof GlueJobHandler !(jobThread.getHandler() instanceof GlueJobHandler
&& ((GlueJobHandler) jobThread.getHandler()).getGlueUpdatetime()==triggerParam.getGlueUpdatetime() )) { && ((GlueJobHandler) jobThread.getHandler()).getGlueUpdatetime()== triggerRequest.getGlueUpdatetime() )) {
// change handler or gluesource updated, need kill old thread // change handler or gluesource updated, need kill old thread
removeOldReason = "change job source or glue type, and terminate the old job thread."; removeOldReason = "change job source or glue type, and terminate the old job thread.";
@ -90,8 +90,8 @@ public class ExecutorBizImpl implements ExecutorBiz {
// valid handler // valid handler
if (jobHandler == null) { if (jobHandler == null) {
try { try {
IJobHandler originJobHandler = GlueFactory.getInstance().loadNewInstance(triggerParam.getGlueSource()); IJobHandler originJobHandler = GlueFactory.getInstance().loadNewInstance(triggerRequest.getGlueSource());
jobHandler = new GlueJobHandler(originJobHandler, triggerParam.getGlueUpdatetime()); jobHandler = new GlueJobHandler(originJobHandler, triggerRequest.getGlueUpdatetime());
} catch (Exception e) { } catch (Exception e) {
logger.error(e.getMessage(), e); logger.error(e.getMessage(), e);
return ReturnT.ofFail( e.getMessage()); return ReturnT.ofFail( e.getMessage());
@ -102,7 +102,7 @@ public class ExecutorBizImpl implements ExecutorBiz {
// valid old jobThread // valid old jobThread
if (jobThread != null && if (jobThread != null &&
!(jobThread.getHandler() instanceof ScriptJobHandler !(jobThread.getHandler() instanceof ScriptJobHandler
&& ((ScriptJobHandler) jobThread.getHandler()).getGlueUpdatetime()==triggerParam.getGlueUpdatetime() )) { && ((ScriptJobHandler) jobThread.getHandler()).getGlueUpdatetime()== triggerRequest.getGlueUpdatetime() )) {
// change script or gluesource updated, need kill old thread // change script or gluesource updated, need kill old thread
removeOldReason = "change job source or glue type, and terminate the old job thread."; removeOldReason = "change job source or glue type, and terminate the old job thread.";
@ -112,15 +112,15 @@ public class ExecutorBizImpl implements ExecutorBiz {
// valid handler // valid handler
if (jobHandler == null) { if (jobHandler == null) {
jobHandler = new ScriptJobHandler(triggerParam.getJobId(), triggerParam.getGlueUpdatetime(), triggerParam.getGlueSource(), GlueTypeEnum.match(triggerParam.getGlueType())); jobHandler = new ScriptJobHandler(triggerRequest.getJobId(), triggerRequest.getGlueUpdatetime(), triggerRequest.getGlueSource(), GlueTypeEnum.match(triggerRequest.getGlueType()));
} }
} else { } else {
return ReturnT.ofFail("glueType[" + triggerParam.getGlueType() + "] is not valid."); return ReturnT.ofFail("glueType[" + triggerRequest.getGlueType() + "] is not valid.");
} }
// executor block strategy // executor block strategy
if (jobThread != null) { if (jobThread != null) {
ExecutorBlockStrategyEnum blockStrategy = ExecutorBlockStrategyEnum.match(triggerParam.getExecutorBlockStrategy(), null); ExecutorBlockStrategyEnum blockStrategy = ExecutorBlockStrategyEnum.match(triggerRequest.getExecutorBlockStrategy(), null);
if (ExecutorBlockStrategyEnum.DISCARD_LATER == blockStrategy) { if (ExecutorBlockStrategyEnum.DISCARD_LATER == blockStrategy) {
// discard when running // discard when running
if (jobThread.isRunningOrHasQueue()) { if (jobThread.isRunningOrHasQueue()) {
@ -140,20 +140,20 @@ public class ExecutorBizImpl implements ExecutorBiz {
// replace thread (new or exists invalid) // replace thread (new or exists invalid)
if (jobThread == null) { if (jobThread == null) {
jobThread = XxlJobExecutor.registJobThread(triggerParam.getJobId(), jobHandler, removeOldReason); jobThread = XxlJobExecutor.registJobThread(triggerRequest.getJobId(), jobHandler, removeOldReason);
} }
// push data to queue // push data to queue
ReturnT<String> pushResult = jobThread.pushTriggerQueue(triggerParam); ReturnT<String> pushResult = jobThread.pushTriggerQueue(triggerRequest);
return pushResult; return pushResult;
} }
@Override @Override
public ReturnT<String> kill(KillParam killParam) { public ReturnT<String> kill(KillRequest killRequest) {
// kill handlerThread, and create new one // kill handlerThread, and create new one
JobThread jobThread = XxlJobExecutor.loadJobThread(killParam.getJobId()); JobThread jobThread = XxlJobExecutor.loadJobThread(killRequest.getJobId());
if (jobThread != null) { if (jobThread != null) {
XxlJobExecutor.removeJobThread(killParam.getJobId(), "scheduling center kill job."); XxlJobExecutor.removeJobThread(killRequest.getJobId(), "scheduling center kill job.");
return ReturnT.ofSuccess(); return ReturnT.ofSuccess();
} }
@ -161,11 +161,11 @@ public class ExecutorBizImpl implements ExecutorBiz {
} }
@Override @Override
public ReturnT<LogResult> log(LogParam logParam) { public ReturnT<LogResult> log(LogRequest logRequest) {
// log filename: logPath/yyyy-MM-dd/9999.log // log filename: logPath/yyyy-MM-dd/9999.log
String logFileName = XxlJobFileAppender.makeLogFileName(new Date(logParam.getLogDateTim()), logParam.getLogId()); String logFileName = XxlJobFileAppender.makeLogFileName(new Date(logRequest.getLogDateTim()), logRequest.getLogId());
LogResult logResult = XxlJobFileAppender.readLog(logFileName, logParam.getFromLineNum()); LogResult logResult = XxlJobFileAppender.readLog(logFileName, logRequest.getFromLineNum());
return ReturnT.ofSuccess(logResult); return ReturnT.ofSuccess(logResult);
} }

@ -5,7 +5,7 @@ import java.io.Serializable;
/** /**
* Created by xuxueli on 17/3/2. * Created by xuxueli on 17/3/2.
*/ */
public class HandleCallbackParam implements Serializable { public class HandleCallbackRequest implements Serializable {
private static final long serialVersionUID = 42L; private static final long serialVersionUID = 42L;
private long logId; private long logId;
@ -14,8 +14,8 @@ public class HandleCallbackParam implements Serializable {
private int handleCode; private int handleCode;
private String handleMsg; private String handleMsg;
public HandleCallbackParam(){} public HandleCallbackRequest(){}
public HandleCallbackParam(long logId, long logDateTim, int handleCode, String handleMsg) { public HandleCallbackRequest(long logId, long logDateTim, int handleCode, String handleMsg) {
this.logId = logId; this.logId = logId;
this.logDateTim = logDateTim; this.logDateTim = logDateTim;
this.handleCode = handleCode; this.handleCode = handleCode;

@ -5,12 +5,12 @@ import java.io.Serializable;
/** /**
* @author xuxueli 2020-04-11 22:27 * @author xuxueli 2020-04-11 22:27
*/ */
public class IdleBeatParam implements Serializable { public class IdleBeatRequest implements Serializable {
private static final long serialVersionUID = 42L; private static final long serialVersionUID = 42L;
public IdleBeatParam() { public IdleBeatRequest() {
} }
public IdleBeatParam(int jobId) { public IdleBeatRequest(int jobId) {
this.jobId = jobId; this.jobId = jobId;
} }

@ -5,12 +5,12 @@ import java.io.Serializable;
/** /**
* @author xuxueli 2020-04-11 22:27 * @author xuxueli 2020-04-11 22:27
*/ */
public class KillParam implements Serializable { public class KillRequest implements Serializable {
private static final long serialVersionUID = 42L; private static final long serialVersionUID = 42L;
public KillParam() { public KillRequest() {
} }
public KillParam(int jobId) { public KillRequest(int jobId) {
this.jobId = jobId; this.jobId = jobId;
} }

@ -5,12 +5,12 @@ import java.io.Serializable;
/** /**
* @author xuxueli 2020-04-11 22:27 * @author xuxueli 2020-04-11 22:27
*/ */
public class LogParam implements Serializable { public class LogRequest implements Serializable {
private static final long serialVersionUID = 42L; private static final long serialVersionUID = 42L;
public LogParam() { public LogRequest() {
} }
public LogParam(long logDateTim, long logId, int fromLineNum) { public LogRequest(long logDateTim, long logId, int fromLineNum) {
this.logDateTim = logDateTim; this.logDateTim = logDateTim;
this.logId = logId; this.logId = logId;
this.fromLineNum = fromLineNum; this.fromLineNum = fromLineNum;

@ -5,15 +5,15 @@ import java.io.Serializable;
/** /**
* Created by xuxueli on 2017-05-10 20:22:42 * Created by xuxueli on 2017-05-10 20:22:42
*/ */
public class RegistryParam implements Serializable { public class RegistryRequest implements Serializable {
private static final long serialVersionUID = 42L; private static final long serialVersionUID = 42L;
private String registryGroup; private String registryGroup;
private String registryKey; private String registryKey;
private String registryValue; private String registryValue;
public RegistryParam(){} public RegistryRequest(){}
public RegistryParam(String registryGroup, String registryKey, String registryValue) { public RegistryRequest(String registryGroup, String registryKey, String registryValue) {
this.registryGroup = registryGroup; this.registryGroup = registryGroup;
this.registryKey = registryKey; this.registryKey = registryKey;
this.registryValue = registryValue; this.registryValue = registryValue;

@ -5,7 +5,7 @@ import java.io.Serializable;
/** /**
* Created by xuxueli on 16/7/22. * Created by xuxueli on 16/7/22.
*/ */
public class TriggerParam implements Serializable{ public class TriggerRequest implements Serializable{
private static final long serialVersionUID = 42L; private static final long serialVersionUID = 42L;
private int jobId; private int jobId;

@ -186,16 +186,16 @@ public class EmbedServer {
case "/beat": case "/beat":
return executorBiz.beat(); return executorBiz.beat();
case "/idleBeat": case "/idleBeat":
IdleBeatParam idleBeatParam = GsonTool.fromJson(requestData, IdleBeatParam.class); IdleBeatRequest idleBeatParam = GsonTool.fromJson(requestData, IdleBeatRequest.class);
return executorBiz.idleBeat(idleBeatParam); return executorBiz.idleBeat(idleBeatParam);
case "/run": case "/run":
TriggerParam triggerParam = GsonTool.fromJson(requestData, TriggerParam.class); TriggerRequest triggerParam = GsonTool.fromJson(requestData, TriggerRequest.class);
return executorBiz.run(triggerParam); return executorBiz.run(triggerParam);
case "/kill": case "/kill":
KillParam killParam = GsonTool.fromJson(requestData, KillParam.class); KillRequest killParam = GsonTool.fromJson(requestData, KillRequest.class);
return executorBiz.kill(killParam); return executorBiz.kill(killParam);
case "/log": case "/log":
LogParam logParam = GsonTool.fromJson(requestData, LogParam.class); LogRequest logParam = GsonTool.fromJson(requestData, LogRequest.class);
return executorBiz.log(logParam); return executorBiz.log(logParam);
default: default:
return ReturnT.ofFail( "invalid request, uri-mapping(" + uri + ") not found."); return ReturnT.ofFail( "invalid request, uri-mapping(" + uri + ") not found.");

@ -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.biz.AdminBiz;
import com.xxl.job.core.biz.model.RegistryParam; import com.xxl.job.core.biz.model.RegistryRequest;
import com.xxl.job.core.biz.model.ReturnT; import com.xxl.job.core.biz.model.ReturnT;
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;
@ -42,7 +42,7 @@ public class ExecutorRegistryThread {
// registry // registry
while (!toStop) { while (!toStop) {
try { try {
RegistryParam registryParam = new RegistryParam(RegistryConfig.RegistType.EXECUTOR.name(), appname, address); RegistryRequest registryParam = new RegistryRequest(RegistryConfig.RegistType.EXECUTOR.name(), appname, address);
for (AdminBiz adminBiz: XxlJobExecutor.getAdminBizList()) { for (AdminBiz adminBiz: XxlJobExecutor.getAdminBizList()) {
try { try {
ReturnT<String> registryResult = adminBiz.registry(registryParam); ReturnT<String> registryResult = adminBiz.registry(registryParam);
@ -78,7 +78,7 @@ public class ExecutorRegistryThread {
// registry remove // registry remove
try { try {
RegistryParam registryParam = new RegistryParam(RegistryConfig.RegistType.EXECUTOR.name(), appname, address); RegistryRequest registryParam = new RegistryRequest(RegistryConfig.RegistType.EXECUTOR.name(), appname, address);
for (AdminBiz adminBiz: XxlJobExecutor.getAdminBizList()) { for (AdminBiz adminBiz: XxlJobExecutor.getAdminBizList()) {
try { try {
ReturnT<String> registryResult = adminBiz.registryRemove(registryParam); ReturnT<String> registryResult = adminBiz.registryRemove(registryParam);

@ -1,8 +1,8 @@
package com.xxl.job.core.thread; package com.xxl.job.core.thread;
import com.xxl.job.core.biz.model.HandleCallbackParam; import com.xxl.job.core.biz.model.HandleCallbackRequest;
import com.xxl.job.core.biz.model.ReturnT; import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.biz.model.TriggerParam; import com.xxl.job.core.biz.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;
@ -13,9 +13,7 @@ import org.slf4j.LoggerFactory;
import java.io.PrintWriter; import java.io.PrintWriter;
import java.io.StringWriter; import java.io.StringWriter;
import java.util.Collections;
import java.util.Date; import java.util.Date;
import java.util.HashSet;
import java.util.Set; import java.util.Set;
import java.util.concurrent.*; import java.util.concurrent.*;
@ -29,7 +27,7 @@ public class JobThread extends Thread{
private int jobId; private int jobId;
private IJobHandler handler; private IJobHandler handler;
private LinkedBlockingQueue<TriggerParam> triggerQueue; private LinkedBlockingQueue<TriggerRequest> triggerQueue;
private Set<Long> triggerLogIdSet; // avoid repeat trigger for the same TRIGGER_LOG_ID private Set<Long> triggerLogIdSet; // avoid repeat trigger for the same TRIGGER_LOG_ID
private volatile boolean toStop = false; private volatile boolean toStop = false;
@ -42,7 +40,7 @@ public class JobThread extends Thread{
public JobThread(int jobId, IJobHandler handler) { public JobThread(int jobId, IJobHandler handler) {
this.jobId = jobId; this.jobId = jobId;
this.handler = handler; this.handler = handler;
this.triggerQueue = new LinkedBlockingQueue<TriggerParam>(); this.triggerQueue = new LinkedBlockingQueue<TriggerRequest>();
//this.triggerLogIdSet = Collections.synchronizedSet(new HashSet<Long>()); //this.triggerLogIdSet = Collections.synchronizedSet(new HashSet<Long>());
this.triggerLogIdSet = ConcurrentHashMap.newKeySet(); this.triggerLogIdSet = ConcurrentHashMap.newKeySet();
@ -59,7 +57,7 @@ public class JobThread extends Thread{
* @param triggerParam * @param triggerParam
* @return * @return
*/ */
public ReturnT<String> pushTriggerQueue(TriggerParam triggerParam) { public ReturnT<String> pushTriggerQueue(TriggerRequest triggerParam) {
// 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());
@ -109,7 +107,7 @@ public class JobThread extends Thread{
running = false; running = false;
idleTimes++; idleTimes++;
TriggerParam triggerParam = null; TriggerRequest triggerParam = null;
try { try {
// to check toStop signal, we need cycle, so we cannot use queue.take(), instead of poll(timeout) // to check toStop signal, we need cycle, so we cannot use queue.take(), instead of poll(timeout)
triggerParam = triggerQueue.poll(3L, TimeUnit.SECONDS); triggerParam = triggerQueue.poll(3L, TimeUnit.SECONDS);
@ -208,7 +206,7 @@ public class JobThread extends Thread{
// callback handler info // callback handler info
if (!toStop) { if (!toStop) {
// common // common
TriggerCallbackThread.pushCallBack(new HandleCallbackParam( TriggerCallbackThread.pushCallBack(new HandleCallbackRequest(
triggerParam.getLogId(), triggerParam.getLogId(),
triggerParam.getLogDateTime(), triggerParam.getLogDateTime(),
XxlJobContext.getXxlJobContext().getHandleCode(), XxlJobContext.getXxlJobContext().getHandleCode(),
@ -216,7 +214,7 @@ public class JobThread extends Thread{
); );
} else { } else {
// is killed // is killed
TriggerCallbackThread.pushCallBack(new HandleCallbackParam( TriggerCallbackThread.pushCallBack(new HandleCallbackRequest(
triggerParam.getLogId(), triggerParam.getLogId(),
triggerParam.getLogDateTime(), triggerParam.getLogDateTime(),
XxlJobContext.HANDLE_CODE_FAIL, XxlJobContext.HANDLE_CODE_FAIL,
@ -229,10 +227,10 @@ public class JobThread extends Thread{
// callback trigger request in queue // callback trigger request in queue
while(triggerQueue !=null && triggerQueue.size()>0){ while(triggerQueue !=null && triggerQueue.size()>0){
TriggerParam triggerParam = triggerQueue.poll(); TriggerRequest triggerParam = triggerQueue.poll();
if (triggerParam!=null) { if (triggerParam!=null) {
// is killed // is killed
TriggerCallbackThread.pushCallBack(new HandleCallbackParam( TriggerCallbackThread.pushCallBack(new HandleCallbackRequest(
triggerParam.getLogId(), triggerParam.getLogId(),
triggerParam.getLogDateTime(), triggerParam.getLogDateTime(),
XxlJobContext.HANDLE_CODE_FAIL, XxlJobContext.HANDLE_CODE_FAIL,

@ -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.biz.AdminBiz;
import com.xxl.job.core.biz.model.HandleCallbackParam; import com.xxl.job.core.biz.model.HandleCallbackRequest;
import com.xxl.job.core.biz.model.ReturnT; import com.xxl.job.core.biz.model.ReturnT;
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;
@ -41,8 +41,8 @@ public class TriggerCallbackThread {
/** /**
* job results callback queue * job results callback queue
*/ */
private final LinkedBlockingQueue<HandleCallbackParam> callBackQueue = new LinkedBlockingQueue<>(); private final LinkedBlockingQueue<HandleCallbackRequest> callBackQueue = new LinkedBlockingQueue<>();
public static void pushCallBack(HandleCallbackParam callback){ public static void pushCallBack(HandleCallbackRequest callback){
getInstance().callBackQueue.add(callback); getInstance().callBackQueue.add(callback);
logger.debug(">>>>>>>>>>> xxl-job, push callback request, logId:{}", callback.getLogId()); logger.debug(">>>>>>>>>>> xxl-job, push callback request, logId:{}", callback.getLogId());
} }
@ -72,11 +72,11 @@ public class TriggerCallbackThread {
// normal callback // normal callback
while(!toStop){ while(!toStop){
try { try {
HandleCallbackParam callback = getInstance().callBackQueue.take(); HandleCallbackRequest callback = getInstance().callBackQueue.take();
if (callback != null) { if (callback != null) {
// collect callback data // collect callback data
List<HandleCallbackParam> callbackParamList = new ArrayList<>(); List<HandleCallbackRequest> callbackParamList = new ArrayList<>();
callbackParamList.add(callback); // add one element callbackParamList.add(callback); // add one element
int drainToNum = getInstance().callBackQueue.drainTo(callbackParamList); // drainTo other all elements int drainToNum = getInstance().callBackQueue.drainTo(callbackParamList); // drainTo other all elements
@ -95,7 +95,7 @@ public class TriggerCallbackThread {
// thead stop, callback lasttime // thead stop, callback lasttime
try { try {
// collect callback data // collect callback data
List<HandleCallbackParam> callbackParamList = new ArrayList<>(); List<HandleCallbackRequest> callbackParamList = new ArrayList<>();
int drainToNum = getInstance().callBackQueue.drainTo(callbackParamList); int drainToNum = getInstance().callBackQueue.drainTo(callbackParamList);
// do callback // do callback
@ -176,7 +176,7 @@ public class TriggerCallbackThread {
* *
* @param callbackParamList callback param list * @param callbackParamList callback param list
*/ */
private void doCallback(List<HandleCallbackParam> callbackParamList){ private void doCallback(List<HandleCallbackRequest> callbackParamList){
boolean callbackRet = false; boolean callbackRet = false;
// callback, will retry if error // callback, will retry if error
for (AdminBiz adminBiz: XxlJobExecutor.getAdminBizList()) { for (AdminBiz adminBiz: XxlJobExecutor.getAdminBizList()) {
@ -201,8 +201,8 @@ public class TriggerCallbackThread {
/** /**
* callback log * callback log
*/ */
private void callbackLog(List<HandleCallbackParam> callbackParamList, String logContent){ private void callbackLog(List<HandleCallbackRequest> callbackParamList, String logContent){
for (HandleCallbackParam callbackParam: callbackParamList) { for (HandleCallbackRequest callbackParam: callbackParamList) {
String logFileName = XxlJobFileAppender.makeLogFileName(new Date(callbackParam.getLogDateTim()), callbackParam.getLogId()); String logFileName = XxlJobFileAppender.makeLogFileName(new Date(callbackParam.getLogDateTim()), callbackParam.getLogId());
XxlJobContext.setXxlJobContext(new XxlJobContext( XxlJobContext.setXxlJobContext(new XxlJobContext(
-1, -1,
@ -231,7 +231,7 @@ public class TriggerCallbackThread {
* *
* @param callbackParamList callback param list * @param callbackParamList callback param list
*/ */
private void appendFailCallbackFile(List<HandleCallbackParam> callbackParamList) { private void appendFailCallbackFile(List<HandleCallbackRequest> callbackParamList) {
// valid // valid
if (CollectionTool.isEmpty(callbackParamList)) { if (CollectionTool.isEmpty(callbackParamList)) {
return; return;
@ -284,7 +284,7 @@ public class TriggerCallbackThread {
} }
// parse callback param // parse callback param
List<HandleCallbackParam> callbackParamList = GsonTool.fromJsonList(callbackData, HandleCallbackParam.class); List<HandleCallbackRequest> callbackParamList = GsonTool.fromJsonList(callbackData, HandleCallbackRequest.class);
FileTool.delete(callbackLogFile); FileTool.delete(callbackLogFile);
// retry callback // retry callback

Loading…
Cancel
Save