diff --git a/xxl-job-admin/src/main/webapp/static/js/jobinfo.index.1.js b/xxl-job-admin/src/main/webapp/static/js/jobinfo.index.1.js
index dc72a572..487108cd 100644
--- a/xxl-job-admin/src/main/webapp/static/js/jobinfo.index.1.js
+++ b/xxl-job-admin/src/main/webapp/static/js/jobinfo.index.1.js
@@ -91,7 +91,7 @@ $(function() {
var codeUrl = base_url +'/jobcode?jobGroup='+ row.jobGroup +'&jobName='+ row.jobName;
codeBtn = '
'
}
-
+
var html = '
serviceBeanMap = XxlJobExecutor.applicationContext.getBeansWithAnnotation(JobHander.class);
if (serviceBeanMap!=null && serviceBeanMap.size()>0) {
for (Object serviceBean : serviceBeanMap.values()) {
- String jobName = serviceBean.getClass().getAnnotation(JobHander.class).value();
- if (jobName!=null && jobName.trim().length()>0 && serviceBean instanceof IJobHandler) {
- IJobHandler handler = (IJobHandler) serviceBean;
- HandlerRepository.regist(jobName, handler);
- }
+ if (serviceBean instanceof IJobHandler){
+ String jobKeys = serviceBean.getClass().getAnnotation(JobHander.class).value();
+ if (jobKeys!=null && jobKeys.trim().length()>0) {
+ Set jobKeySet = new HashSet(Arrays.asList(jobKeys.split(",")));
+ for (String jobKey : jobKeySet) {
+ IJobHandler handler = (IJobHandler) serviceBean;
+ HandlerRepository.regist(jobKey, handler);
+ }
+ }
+ }
}
}
}
diff --git a/xxl-job-core/src/main/java/com/xxl/job/core/handler/HandlerRepository.java b/xxl-job-core/src/main/java/com/xxl/job/core/handler/HandlerRepository.java
index 5a805fd9..4d162db2 100644
--- a/xxl-job-core/src/main/java/com/xxl/job/core/handler/HandlerRepository.java
+++ b/xxl-job-core/src/main/java/com/xxl/job/core/handler/HandlerRepository.java
@@ -102,7 +102,6 @@ public class HandlerRepository {
callback.setMsg("JOB_GROUP or JOB_NAME is null.");
return JacksonUtil.writeValueAsString(callback);
}
- String jobKey = job_group.concat("_").concat(job_name);
// glue switch
String handler_glue_switch = _param.get(HandlerParamEnum.GLUE_SWITCH.name());
@@ -111,7 +110,8 @@ public class HandlerRepository {
return JacksonUtil.writeValueAsString(callback);
}
- HandlerThread handlerThread = handlerTreadMap.get(jobKey);;
+ String jobKey = job_group.concat("_").concat(job_name);
+ HandlerThread handlerThread = handlerTreadMap.get(jobKey);
if ("0".equals(handler_glue_switch)) {
// bean model
if (handlerThread == null) {
@@ -129,27 +129,6 @@ public class HandlerRepository {
// push data to queue
handlerThread.pushData(_param);
callback.setStatus(RemoteCallBack.SUCCESS);
- } else if (namespace.equals(ActionEnum.LOG.name())) {
- String log_id = _param.get(HandlerParamEnum.LOG_ID.name());
- String log_date = _param.get(HandlerParamEnum.LOG_DATE.name());
- if (log_id==null || log_date==null) {
- callback.setMsg("LOG_ID | LOG_DATE can not be null.");
- return JacksonUtil.writeValueAsString(callback);
- }
- int logId = -1;
- Date triggerDate = null;
- try {
- logId = Integer.valueOf(log_id);
- triggerDate = new Date(Long.valueOf(log_date));
- } catch (Exception e) {
- }
- if (logId<=0 || triggerDate==null) {
- callback.setMsg("LOG_ID | LOG_DATE parse error.");
- return JacksonUtil.writeValueAsString(callback);
- }
- String logConteng = XxlJobFileAppender.readLog(triggerDate, log_id);
- callback.setStatus(RemoteCallBack.SUCCESS);
- callback.setMsg(logConteng);
} else if (namespace.equals(ActionEnum.KILL.name())) {
// generate jobKey
String job_group = _param.get(HandlerParamEnum.JOB_GROUP.name());
@@ -171,7 +150,28 @@ public class HandlerRepository {
} else {
callback.setMsg("handler for jobKey=[" + jobKey + "] not found.");
}
-
+
+ } else if (namespace.equals(ActionEnum.LOG.name())) {
+ String log_id = _param.get(HandlerParamEnum.LOG_ID.name());
+ String log_date = _param.get(HandlerParamEnum.LOG_DATE.name());
+ if (log_id==null || log_date==null) {
+ callback.setMsg("LOG_ID | LOG_DATE can not be null.");
+ return JacksonUtil.writeValueAsString(callback);
+ }
+ int logId = -1;
+ Date triggerDate = null;
+ try {
+ logId = Integer.valueOf(log_id);
+ triggerDate = new Date(Long.valueOf(log_date));
+ } catch (Exception e) {
+ }
+ if (logId<=0 || triggerDate==null) {
+ callback.setMsg("LOG_ID | LOG_DATE parse error.");
+ return JacksonUtil.writeValueAsString(callback);
+ }
+ String logConteng = XxlJobFileAppender.readLog(triggerDate, log_id);
+ callback.setStatus(RemoteCallBack.SUCCESS);
+ callback.setMsg(logConteng);
} else if (namespace.equals(ActionEnum.BEAT.name())) {
callback.setStatus(RemoteCallBack.SUCCESS);
callback.setMsg(null);
diff --git a/xxl-job-executor-example/src/main/java/com/xxl/job/executor/service/jobhandler/DemoJobHandler.java b/xxl-job-executor-example/src/main/java/com/xxl/job/executor/service/jobhandler/DemoJobHandler.java
index 831a5a63..e18643fa 100644
--- a/xxl-job-executor-example/src/main/java/com/xxl/job/executor/service/jobhandler/DemoJobHandler.java
+++ b/xxl-job-executor-example/src/main/java/com/xxl/job/executor/service/jobhandler/DemoJobHandler.java
@@ -16,11 +16,11 @@ import com.xxl.job.core.handler.annotation.JobHander;
* 开发步骤:
* 1、继承 “IJobHandler” ;
* 2、装配到Spring,例如加 “@Service” 注解;
- * 3、加 “@JobHander” 注解,自定义属性name的值;name值在配置新任务是使用;
+ * 3、加 “@JobHander” 注解,注解value值为新增任务生成的JobKey的值;多个JobKey用逗号分割;
*
* @author xuxueli 2015-12-19 19:43:36
*/
-@JobHander(value="defaults_201607192222270796")
+@JobHander(value="defaults_201607192256270689,defaults_201607192256270689")
@Service
public class DemoJobHandler extends IJobHandler {
private static transient Logger logger = LoggerFactory.getLogger(DemoJobHandler.class);