diff --git a/README.md b/README.md index 5feb0a07..cf6ed8ed 100644 --- a/README.md +++ b/README.md @@ -39,9 +39,9 @@ git.osc地址:http://git.oschina.net/xuxueli0323/xxl-job 5、支持“串行执行”,并行执行; 说明:V1.2版本将系统架构按功能拆分为: - 调度模块[xxl-job-admin]:负责管理调度信息,按照调度配置发出调度请求; - 任务模块[xxl-job-client-demo]:负责接收调度请求并执行任务逻辑;任务模块可以方便的嵌入web项目,可以参考此demo; - 通讯模块[xxl-job-client]:负责调度模块和任务模块之间的信息通讯; + 调度模块(调度中心):负责管理调度信息,按照调度配置发出调度请求; + 执行模块(执行器):负责接收调度请求并执行任务逻辑; + 通讯模块:负责调度模块和任务模块之间的信息通讯; 优点: 解耦:任务模块提供任务接口,调度模块维护调度信息,业务相互独立; 高扩展性; @@ -56,7 +56,13 @@ git.osc地址:http://git.oschina.net/xuxueli0323/xxl-job “执行器” 模式简介: BEAN模式执行器:每个执行器都是Spring的一个Bean实例,XXL-JOB通过注解@JobHander识别和调度执行器; GLUE模式执行器:每个执行器对应一段代码,在线Web编辑和维护,动态编译生效,执行器负责加载GLUE代码和执行; - + +# 源码目录说明 + /xxl-job-admin 【调度中心】:负责管理调度信息,按照调度配置发出调度请求; + /xxl-job-core 公共依赖 + /xxl-job-executor-example 【执行器】:负责接收调度请求并执行任务逻辑; + /db 建表脚本 + /doc 用户手册 # Tips 更多接入公司,欢迎在https://github.com/xuxueli/xxl-job/issues/1 登记。 @@ -64,4 +70,5 @@ git.osc地址:http://git.oschina.net/xuxueli0323/xxl-job ![image](http://images2015.cnblogs.com/blog/554415/201605/554415-20160513183306234-1939652116.png) + 技术的发展离不开你的支持,请作者喝杯咖啡吧! diff --git a/doc/db/tables_mysql(备份,请忽略).sql b/db/tables_mysql(备份,请忽略).sql similarity index 100% rename from doc/db/tables_mysql(备份,请忽略).sql rename to db/tables_mysql(备份,请忽略).sql diff --git a/doc/db/tables_xxl_job.sql b/db/tables_xxl_job.sql similarity index 100% rename from doc/db/tables_xxl_job.sql rename to db/tables_xxl_job.sql diff --git a/doc/XXL-JOB1.3.x用户手册_20160522_2306.pdf b/doc/XXL-JOB1.3.x用户手册_20160522_2306.pdf deleted file mode 100644 index 9e9960ac..00000000 Binary files a/doc/XXL-JOB1.3.x用户手册_20160522_2306.pdf and /dev/null differ diff --git a/xxl-job-admin/.gitignore b/xxl-job-admin/.gitignore index f302498c..409b134f 100644 --- a/xxl-job-admin/.gitignore +++ b/xxl-job-admin/.gitignore @@ -2,4 +2,5 @@ /.settings/ /.classpath /.project -/xxl-job-admin.iml \ No newline at end of file +/xxl-job-admin.iml +/target/ diff --git a/xxl-job-admin/pom.xml b/xxl-job-admin/pom.xml index 8b8dc129..b2fabc1d 100644 --- a/xxl-job-admin/pom.xml +++ b/xxl-job-admin/pom.xml @@ -144,10 +144,10 @@ 2.2.3 - + com.xxl - xxl-job-client + xxl-job-core 1.3.1 diff --git a/xxl-job-admin/src/main/java/com/xxl/job/controller/IndexController.java b/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/IndexController.java similarity index 86% rename from xxl-job-admin/src/main/java/com/xxl/job/controller/IndexController.java rename to xxl-job-admin/src/main/java/com/xxl/job/admin/controller/IndexController.java index c69ec9b1..464ff10d 100644 --- a/xxl-job-admin/src/main/java/com/xxl/job/controller/IndexController.java +++ b/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/IndexController.java @@ -1,4 +1,4 @@ -package com.xxl.job.controller; +package com.xxl.job.admin.controller; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -10,10 +10,10 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; -import com.xxl.job.controller.annotation.PermessionLimit; -import com.xxl.job.controller.interceptor.PermissionInterceptor; -import com.xxl.job.core.model.ReturnT; -import com.xxl.job.core.util.PropertiesUtil; +import com.xxl.job.admin.controller.annotation.PermessionLimit; +import com.xxl.job.admin.controller.interceptor.PermissionInterceptor; +import com.xxl.job.admin.core.model.ReturnT; +import com.xxl.job.admin.core.util.PropertiesUtil; /** * index controller diff --git a/xxl-job-admin/src/main/java/com/xxl/job/controller/JobCodeController.java b/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobCodeController.java similarity index 86% rename from xxl-job-admin/src/main/java/com/xxl/job/controller/JobCodeController.java rename to xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobCodeController.java index ffb23c27..d64cd139 100644 --- a/xxl-job-admin/src/main/java/com/xxl/job/controller/JobCodeController.java +++ b/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobCodeController.java @@ -1,4 +1,4 @@ -package com.xxl.job.controller; +package com.xxl.job.admin.controller; import java.util.List; @@ -10,11 +10,11 @@ import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; -import com.xxl.job.core.model.ReturnT; -import com.xxl.job.core.model.XxlJobInfo; -import com.xxl.job.core.model.XxlJobLogGlue; -import com.xxl.job.dao.IXxlJobInfoDao; -import com.xxl.job.dao.IXxlJobLogGlueDao; +import com.xxl.job.admin.core.model.ReturnT; +import com.xxl.job.admin.core.model.XxlJobInfo; +import com.xxl.job.admin.core.model.XxlJobLogGlue; +import com.xxl.job.admin.dao.IXxlJobInfoDao; +import com.xxl.job.admin.dao.IXxlJobLogGlueDao; /** * job code controller diff --git a/xxl-job-admin/src/main/java/com/xxl/job/controller/JobInfoController.java b/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobInfoController.java similarity index 91% rename from xxl-job-admin/src/main/java/com/xxl/job/controller/JobInfoController.java rename to xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobInfoController.java index 1b02bcd0..6dde0d4e 100644 --- a/xxl-job-admin/src/main/java/com/xxl/job/controller/JobInfoController.java +++ b/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobInfoController.java @@ -1,4 +1,4 @@ -package com.xxl.job.controller; +package com.xxl.job.admin.controller; import java.util.HashMap; import java.util.List; @@ -15,16 +15,16 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; -import com.xxl.job.client.handler.HandlerRepository; -import com.xxl.job.client.util.JacksonUtil; -import com.xxl.job.core.constant.Constants.JobGroupEnum; -import com.xxl.job.core.model.ReturnT; -import com.xxl.job.core.model.XxlJobInfo; -import com.xxl.job.core.util.DynamicSchedulerUtil; -import com.xxl.job.dao.IXxlJobInfoDao; -import com.xxl.job.dao.IXxlJobLogDao; -import com.xxl.job.dao.IXxlJobLogGlueDao; -import com.xxl.job.service.job.RemoteHttpJobBean; +import com.xxl.job.admin.core.constant.Constants.JobGroupEnum; +import com.xxl.job.admin.core.jobbean.RemoteHttpJobBean; +import com.xxl.job.admin.core.model.ReturnT; +import com.xxl.job.admin.core.model.XxlJobInfo; +import com.xxl.job.admin.core.util.DynamicSchedulerUtil; +import com.xxl.job.admin.dao.IXxlJobInfoDao; +import com.xxl.job.admin.dao.IXxlJobLogDao; +import com.xxl.job.admin.dao.IXxlJobLogGlueDao; +import com.xxl.job.core.handler.HandlerRepository; +import com.xxl.job.core.util.JacksonUtil; /** * index controller diff --git a/xxl-job-admin/src/main/java/com/xxl/job/controller/JobLogController.java b/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobLogController.java similarity index 90% rename from xxl-job-admin/src/main/java/com/xxl/job/controller/JobLogController.java rename to xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobLogController.java index 8c3086f7..67c8c6be 100644 --- a/xxl-job-admin/src/main/java/com/xxl/job/controller/JobLogController.java +++ b/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobLogController.java @@ -1,4 +1,4 @@ -package com.xxl.job.controller; +package com.xxl.job.admin.controller; import java.text.ParseException; import java.util.Date; @@ -16,14 +16,14 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; -import com.xxl.job.client.handler.HandlerRepository; -import com.xxl.job.client.util.HttpUtil; -import com.xxl.job.client.util.HttpUtil.RemoteCallBack; -import com.xxl.job.client.util.JacksonUtil; -import com.xxl.job.core.constant.Constants.JobGroupEnum; -import com.xxl.job.core.model.ReturnT; -import com.xxl.job.core.model.XxlJobLog; -import com.xxl.job.dao.IXxlJobLogDao; +import com.xxl.job.admin.core.constant.Constants.JobGroupEnum; +import com.xxl.job.admin.core.model.ReturnT; +import com.xxl.job.admin.core.model.XxlJobLog; +import com.xxl.job.admin.dao.IXxlJobLogDao; +import com.xxl.job.core.handler.HandlerRepository; +import com.xxl.job.core.util.HttpUtil; +import com.xxl.job.core.util.HttpUtil.RemoteCallBack; +import com.xxl.job.core.util.JacksonUtil; /** * index controller diff --git a/xxl-job-admin/src/main/java/com/xxl/job/controller/annotation/PermessionLimit.java b/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/annotation/PermessionLimit.java similarity index 85% rename from xxl-job-admin/src/main/java/com/xxl/job/controller/annotation/PermessionLimit.java rename to xxl-job-admin/src/main/java/com/xxl/job/admin/controller/annotation/PermessionLimit.java index 7869844a..db037998 100644 --- a/xxl-job-admin/src/main/java/com/xxl/job/controller/annotation/PermessionLimit.java +++ b/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/annotation/PermessionLimit.java @@ -1,4 +1,4 @@ -package com.xxl.job.controller.annotation; +package com.xxl.job.admin.controller.annotation; import java.lang.annotation.ElementType; diff --git a/xxl-job-admin/src/main/java/com/xxl/job/controller/interceptor/CookieInterceptor.java b/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/interceptor/CookieInterceptor.java similarity index 92% rename from xxl-job-admin/src/main/java/com/xxl/job/controller/interceptor/CookieInterceptor.java rename to xxl-job-admin/src/main/java/com/xxl/job/admin/controller/interceptor/CookieInterceptor.java index 876473bd..8072b458 100644 --- a/xxl-job-admin/src/main/java/com/xxl/job/controller/interceptor/CookieInterceptor.java +++ b/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/interceptor/CookieInterceptor.java @@ -1,4 +1,4 @@ -package com.xxl.job.controller.interceptor; +package com.xxl.job.admin.controller.interceptor; import java.util.HashMap; diff --git a/xxl-job-admin/src/main/java/com/xxl/job/controller/interceptor/PermissionInterceptor.java b/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/interceptor/PermissionInterceptor.java similarity index 88% rename from xxl-job-admin/src/main/java/com/xxl/job/controller/interceptor/PermissionInterceptor.java rename to xxl-job-admin/src/main/java/com/xxl/job/admin/controller/interceptor/PermissionInterceptor.java index 17b2a98b..eb592dd6 100644 --- a/xxl-job-admin/src/main/java/com/xxl/job/controller/interceptor/PermissionInterceptor.java +++ b/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/interceptor/PermissionInterceptor.java @@ -1,4 +1,4 @@ -package com.xxl.job.controller.interceptor; +package com.xxl.job.admin.controller.interceptor; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -6,8 +6,8 @@ import javax.servlet.http.HttpServletResponse; import org.springframework.web.method.HandlerMethod; import org.springframework.web.servlet.handler.HandlerInterceptorAdapter; -import com.xxl.job.controller.annotation.PermessionLimit; -import com.xxl.job.core.util.CookieUtil; +import com.xxl.job.admin.controller.annotation.PermessionLimit; +import com.xxl.job.admin.core.util.CookieUtil; /** * 权限拦截, 简易版 diff --git a/xxl-job-admin/src/main/java/com/xxl/job/controller/resolver/WebExceptionResolver.java b/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/resolver/WebExceptionResolver.java similarity index 88% rename from xxl-job-admin/src/main/java/com/xxl/job/controller/resolver/WebExceptionResolver.java rename to xxl-job-admin/src/main/java/com/xxl/job/admin/controller/resolver/WebExceptionResolver.java index 9060e28c..818bf8c8 100644 --- a/xxl-job-admin/src/main/java/com/xxl/job/controller/resolver/WebExceptionResolver.java +++ b/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/resolver/WebExceptionResolver.java @@ -1,4 +1,4 @@ -package com.xxl.job.controller.resolver; +package com.xxl.job.admin.controller.resolver; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -10,8 +10,8 @@ import org.springframework.web.method.HandlerMethod; import org.springframework.web.servlet.HandlerExceptionResolver; import org.springframework.web.servlet.ModelAndView; -import com.xxl.job.client.util.JacksonUtil; -import com.xxl.job.core.model.ReturnT; +import com.xxl.job.admin.core.model.ReturnT; +import com.xxl.job.core.util.JacksonUtil; /** * common exception resolver diff --git a/xxl-job-admin/src/main/java/com/xxl/job/core/callback/XxlJobCallbackServer.java b/xxl-job-admin/src/main/java/com/xxl/job/admin/core/callback/XxlJobLogCallbackServer.java similarity index 86% rename from xxl-job-admin/src/main/java/com/xxl/job/core/callback/XxlJobCallbackServer.java rename to xxl-job-admin/src/main/java/com/xxl/job/admin/core/callback/XxlJobLogCallbackServer.java index 473117d5..5ad3c418 100644 --- a/xxl-job-admin/src/main/java/com/xxl/job/core/callback/XxlJobCallbackServer.java +++ b/xxl-job-admin/src/main/java/com/xxl/job/admin/core/callback/XxlJobLogCallbackServer.java @@ -1,4 +1,4 @@ -package com.xxl.job.core.callback; +package com.xxl.job.admin.core.callback; import org.eclipse.jetty.server.Connector; import org.eclipse.jetty.server.Handler; @@ -9,13 +9,13 @@ import org.eclipse.jetty.util.thread.ExecutorThreadPool; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import com.xxl.job.client.util.IpUtil; +import com.xxl.job.core.util.IpUtil; /** * Created by xuxueli on 2016-5-22 11:15:42 */ -public class XxlJobCallbackServer { - private static final Logger logger = LoggerFactory.getLogger(XxlJobCallbackServer.class); +public class XxlJobLogCallbackServer { + private static final Logger logger = LoggerFactory.getLogger(XxlJobLogCallbackServer.class); private static String trigger_log_address; public static String getTrigger_log_address() { @@ -43,7 +43,7 @@ public class XxlJobCallbackServer { // handler HandlerCollection handlerc =new HandlerCollection(); - handlerc.setHandlers(new Handler[]{new XxlJobCallbackServerHandler()}); + handlerc.setHandlers(new Handler[]{new XxlJobLogCallbackServerHandler()}); server.setHandler(handlerc); try { diff --git a/xxl-job-admin/src/main/java/com/xxl/job/core/callback/XxlJobCallbackServerHandler.java b/xxl-job-admin/src/main/java/com/xxl/job/admin/core/callback/XxlJobLogCallbackServerHandler.java similarity index 84% rename from xxl-job-admin/src/main/java/com/xxl/job/core/callback/XxlJobCallbackServerHandler.java rename to xxl-job-admin/src/main/java/com/xxl/job/admin/core/callback/XxlJobLogCallbackServerHandler.java index d10cd84e..9c9a3d31 100644 --- a/xxl-job-admin/src/main/java/com/xxl/job/core/callback/XxlJobCallbackServerHandler.java +++ b/xxl-job-admin/src/main/java/com/xxl/job/admin/core/callback/XxlJobLogCallbackServerHandler.java @@ -1,4 +1,4 @@ -package com.xxl.job.core.callback; +package com.xxl.job.admin.core.callback; import java.io.IOException; import java.util.Date; @@ -11,15 +11,15 @@ import org.apache.commons.lang.StringUtils; import org.eclipse.jetty.server.Request; import org.eclipse.jetty.server.handler.AbstractHandler; -import com.xxl.job.client.util.HttpUtil.RemoteCallBack; -import com.xxl.job.client.util.JacksonUtil; -import com.xxl.job.core.model.XxlJobLog; -import com.xxl.job.core.util.DynamicSchedulerUtil; +import com.xxl.job.admin.core.model.XxlJobLog; +import com.xxl.job.admin.core.util.DynamicSchedulerUtil; +import com.xxl.job.core.util.HttpUtil.RemoteCallBack; +import com.xxl.job.core.util.JacksonUtil; /** * Created by xuxueli on 2016-5-22 11:15:42 */ -public class XxlJobCallbackServerHandler extends AbstractHandler { +public class XxlJobLogCallbackServerHandler extends AbstractHandler { @Override public void handle(String s, Request baseRequest, HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws IOException, ServletException { diff --git a/xxl-job-admin/src/main/java/com/xxl/job/core/constant/Constants.java b/xxl-job-admin/src/main/java/com/xxl/job/admin/core/constant/Constants.java similarity index 88% rename from xxl-job-admin/src/main/java/com/xxl/job/core/constant/Constants.java rename to xxl-job-admin/src/main/java/com/xxl/job/admin/core/constant/Constants.java index 1f76a5b0..ae2625b7 100644 --- a/xxl-job-admin/src/main/java/com/xxl/job/core/constant/Constants.java +++ b/xxl-job-admin/src/main/java/com/xxl/job/admin/core/constant/Constants.java @@ -1,4 +1,4 @@ -package com.xxl.job.core.constant; +package com.xxl.job.admin.core.constant; /** * job group diff --git a/xxl-job-admin/src/main/java/com/xxl/job/service/job/LocalNomalJobBean.java b/xxl-job-admin/src/main/java/com/xxl/job/admin/core/jobbean/LocalNomalJobBean.java similarity index 96% rename from xxl-job-admin/src/main/java/com/xxl/job/service/job/LocalNomalJobBean.java rename to xxl-job-admin/src/main/java/com/xxl/job/admin/core/jobbean/LocalNomalJobBean.java index aa5351fd..7133b0a3 100644 --- a/xxl-job-admin/src/main/java/com/xxl/job/service/job/LocalNomalJobBean.java +++ b/xxl-job-admin/src/main/java/com/xxl/job/admin/core/jobbean/LocalNomalJobBean.java @@ -1,3 +1,4 @@ +package com.xxl.job.admin.core.jobbean; //package com.xxl.job.service.job; // //import java.io.PrintWriter; diff --git a/xxl-job-admin/src/main/java/com/xxl/job/service/job/RemoteHttpJobBean.java b/xxl-job-admin/src/main/java/com/xxl/job/admin/core/jobbean/RemoteHttpJobBean.java similarity index 81% rename from xxl-job-admin/src/main/java/com/xxl/job/service/job/RemoteHttpJobBean.java rename to xxl-job-admin/src/main/java/com/xxl/job/admin/core/jobbean/RemoteHttpJobBean.java index 10d7998e..ff572074 100644 --- a/xxl-job-admin/src/main/java/com/xxl/job/service/job/RemoteHttpJobBean.java +++ b/xxl-job-admin/src/main/java/com/xxl/job/admin/core/jobbean/RemoteHttpJobBean.java @@ -1,4 +1,4 @@ -package com.xxl.job.service.job; +package com.xxl.job.admin.core.jobbean; import java.util.Date; import java.util.HashMap; @@ -11,15 +11,15 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.scheduling.quartz.QuartzJobBean; -import com.xxl.job.client.handler.HandlerRepository; -import com.xxl.job.client.util.HttpUtil; -import com.xxl.job.client.util.HttpUtil.RemoteCallBack; -import com.xxl.job.client.util.JacksonUtil; -import com.xxl.job.core.callback.XxlJobCallbackServer; -import com.xxl.job.core.model.XxlJobInfo; -import com.xxl.job.core.model.XxlJobLog; -import com.xxl.job.core.thread.JobMonitorHelper; -import com.xxl.job.core.util.DynamicSchedulerUtil; +import com.xxl.job.admin.core.callback.XxlJobLogCallbackServer; +import com.xxl.job.admin.core.model.XxlJobInfo; +import com.xxl.job.admin.core.model.XxlJobLog; +import com.xxl.job.admin.core.thread.JobMonitorHelper; +import com.xxl.job.admin.core.util.DynamicSchedulerUtil; +import com.xxl.job.core.handler.HandlerRepository; +import com.xxl.job.core.util.HttpUtil; +import com.xxl.job.core.util.HttpUtil.RemoteCallBack; +import com.xxl.job.core.util.JacksonUtil; /** * http job bean @@ -58,7 +58,7 @@ public class RemoteHttpJobBean extends QuartzJobBean { params.put(HandlerRepository.NAMESPACE, HandlerRepository.NameSpaceEnum.RUN.name()); params.put(HandlerRepository.TRIGGER_LOG_ID, String.valueOf(jobLog.getId())); - params.put(HandlerRepository.TRIGGER_LOG_ADDRESS, XxlJobCallbackServer.getTrigger_log_address()); + params.put(HandlerRepository.TRIGGER_LOG_ADDRESS, XxlJobLogCallbackServer.getTrigger_log_address()); params.put(HandlerRepository.HANDLER_NAME, jobDataMap.get(HandlerRepository.HANDLER_NAME)); params.put(HandlerRepository.HANDLER_PARAMS, jobDataMap.get(HandlerRepository.HANDLER_PARAMS)); diff --git a/xxl-job-admin/src/main/java/com/xxl/job/service/job/impl/DemoConcurrentJobBean.java b/xxl-job-admin/src/main/java/com/xxl/job/admin/core/jobbean/impl/DemoConcurrentJobBean.java similarity index 89% rename from xxl-job-admin/src/main/java/com/xxl/job/service/job/impl/DemoConcurrentJobBean.java rename to xxl-job-admin/src/main/java/com/xxl/job/admin/core/jobbean/impl/DemoConcurrentJobBean.java index a207e4ca..2bf22eb4 100644 --- a/xxl-job-admin/src/main/java/com/xxl/job/service/job/impl/DemoConcurrentJobBean.java +++ b/xxl-job-admin/src/main/java/com/xxl/job/admin/core/jobbean/impl/DemoConcurrentJobBean.java @@ -1,3 +1,4 @@ +package com.xxl.job.admin.core.jobbean.impl; //package com.xxl.job.service.job.impl; // //import java.util.concurrent.TimeUnit; diff --git a/xxl-job-admin/src/main/java/com/xxl/job/service/job/impl/DemoNomalJobBean.java b/xxl-job-admin/src/main/java/com/xxl/job/admin/core/jobbean/impl/DemoNomalJobBean.java similarity index 90% rename from xxl-job-admin/src/main/java/com/xxl/job/service/job/impl/DemoNomalJobBean.java rename to xxl-job-admin/src/main/java/com/xxl/job/admin/core/jobbean/impl/DemoNomalJobBean.java index 1380abbd..8c5a05b4 100644 --- a/xxl-job-admin/src/main/java/com/xxl/job/service/job/impl/DemoNomalJobBean.java +++ b/xxl-job-admin/src/main/java/com/xxl/job/admin/core/jobbean/impl/DemoNomalJobBean.java @@ -1,3 +1,4 @@ +package com.xxl.job.admin.core.jobbean.impl; //package com.xxl.job.service.job.impl; // //import java.util.concurrent.TimeUnit; diff --git a/xxl-job-admin/src/main/java/com/xxl/job/core/model/ReturnT.java b/xxl-job-admin/src/main/java/com/xxl/job/admin/core/model/ReturnT.java similarity index 91% rename from xxl-job-admin/src/main/java/com/xxl/job/core/model/ReturnT.java rename to xxl-job-admin/src/main/java/com/xxl/job/admin/core/model/ReturnT.java index aaeb3f51..205fc74b 100644 --- a/xxl-job-admin/src/main/java/com/xxl/job/core/model/ReturnT.java +++ b/xxl-job-admin/src/main/java/com/xxl/job/admin/core/model/ReturnT.java @@ -1,4 +1,4 @@ -package com.xxl.job.core.model; +package com.xxl.job.admin.core.model; /** * common return diff --git a/xxl-job-admin/src/main/java/com/xxl/job/core/model/XxlJobInfo.java b/xxl-job-admin/src/main/java/com/xxl/job/admin/core/model/XxlJobInfo.java similarity index 94% rename from xxl-job-admin/src/main/java/com/xxl/job/core/model/XxlJobInfo.java rename to xxl-job-admin/src/main/java/com/xxl/job/admin/core/model/XxlJobInfo.java index f838863f..389b2205 100644 --- a/xxl-job-admin/src/main/java/com/xxl/job/core/model/XxlJobInfo.java +++ b/xxl-job-admin/src/main/java/com/xxl/job/admin/core/model/XxlJobInfo.java @@ -1,4 +1,4 @@ -package com.xxl.job.core.model; +package com.xxl.job.admin.core.model; import java.util.Date; diff --git a/xxl-job-admin/src/main/java/com/xxl/job/core/model/XxlJobLog.java b/xxl-job-admin/src/main/java/com/xxl/job/admin/core/model/XxlJobLog.java similarity index 94% rename from xxl-job-admin/src/main/java/com/xxl/job/core/model/XxlJobLog.java rename to xxl-job-admin/src/main/java/com/xxl/job/admin/core/model/XxlJobLog.java index 4ebd9f7f..547d31db 100644 --- a/xxl-job-admin/src/main/java/com/xxl/job/core/model/XxlJobLog.java +++ b/xxl-job-admin/src/main/java/com/xxl/job/admin/core/model/XxlJobLog.java @@ -1,4 +1,4 @@ -package com.xxl.job.core.model; +package com.xxl.job.admin.core.model; import java.util.Date; diff --git a/xxl-job-admin/src/main/java/com/xxl/job/core/model/XxlJobLogGlue.java b/xxl-job-admin/src/main/java/com/xxl/job/admin/core/model/XxlJobLogGlue.java similarity index 93% rename from xxl-job-admin/src/main/java/com/xxl/job/core/model/XxlJobLogGlue.java rename to xxl-job-admin/src/main/java/com/xxl/job/admin/core/model/XxlJobLogGlue.java index 8ea29970..1f1d136f 100644 --- a/xxl-job-admin/src/main/java/com/xxl/job/core/model/XxlJobLogGlue.java +++ b/xxl-job-admin/src/main/java/com/xxl/job/admin/core/model/XxlJobLogGlue.java @@ -1,4 +1,4 @@ -package com.xxl.job.core.model; +package com.xxl.job.admin.core.model; /** * xxl-job log for glue, used to track job code process diff --git a/xxl-job-admin/src/main/java/com/xxl/job/core/thread/JobMonitorHelper.java b/xxl-job-admin/src/main/java/com/xxl/job/admin/core/thread/JobMonitorHelper.java similarity index 86% rename from xxl-job-admin/src/main/java/com/xxl/job/core/thread/JobMonitorHelper.java rename to xxl-job-admin/src/main/java/com/xxl/job/admin/core/thread/JobMonitorHelper.java index c55d492d..4a10ffb7 100644 --- a/xxl-job-admin/src/main/java/com/xxl/job/core/thread/JobMonitorHelper.java +++ b/xxl-job-admin/src/main/java/com/xxl/job/admin/core/thread/JobMonitorHelper.java @@ -1,4 +1,4 @@ -package com.xxl.job.core.thread; +package com.xxl.job.admin.core.thread; import java.text.MessageFormat; import java.util.concurrent.ConcurrentHashMap; @@ -11,11 +11,11 @@ import org.apache.commons.lang.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import com.xxl.job.client.util.HttpUtil.RemoteCallBack; -import com.xxl.job.core.model.XxlJobInfo; -import com.xxl.job.core.model.XxlJobLog; -import com.xxl.job.core.util.DynamicSchedulerUtil; -import com.xxl.job.core.util.MailUtil; +import com.xxl.job.admin.core.model.XxlJobInfo; +import com.xxl.job.admin.core.model.XxlJobLog; +import com.xxl.job.admin.core.util.DynamicSchedulerUtil; +import com.xxl.job.admin.core.util.MailUtil; +import com.xxl.job.core.util.HttpUtil.RemoteCallBack; /** * job monitor helper @@ -62,7 +62,7 @@ public class JobMonitorHelper { XxlJobInfo info = DynamicSchedulerUtil.xxlJobInfoDao.load(log.getJobGroup(), log.getJobName()); if (count >= info.getAlarmThreshold()) { MailUtil.sendMail(info.getAlarmEmail(), "《调度平台中心-监控报警》", - MessageFormat.format("调度任务[{0}]失败报警,连续失败次数:", monotorKey, count), false, null); + MessageFormat.format("调度任务[{0}]失败报警,连续失败次数:{1}", monotorKey, count), false, null); countMap.remove(monotorKey); } } diff --git a/xxl-job-admin/src/main/java/com/xxl/job/core/util/CookieUtil.java b/xxl-job-admin/src/main/java/com/xxl/job/admin/core/util/CookieUtil.java similarity index 94% rename from xxl-job-admin/src/main/java/com/xxl/job/core/util/CookieUtil.java rename to xxl-job-admin/src/main/java/com/xxl/job/admin/core/util/CookieUtil.java index bc15cba3..d4724323 100644 --- a/xxl-job-admin/src/main/java/com/xxl/job/core/util/CookieUtil.java +++ b/xxl-job-admin/src/main/java/com/xxl/job/admin/core/util/CookieUtil.java @@ -1,4 +1,4 @@ -package com.xxl.job.core.util; +package com.xxl.job.admin.core.util; import javax.servlet.http.Cookie; import javax.servlet.http.HttpServletRequest; diff --git a/xxl-job-admin/src/main/java/com/xxl/job/core/util/DynamicSchedulerUtil.java b/xxl-job-admin/src/main/java/com/xxl/job/admin/core/util/DynamicSchedulerUtil.java similarity index 94% rename from xxl-job-admin/src/main/java/com/xxl/job/core/util/DynamicSchedulerUtil.java rename to xxl-job-admin/src/main/java/com/xxl/job/admin/core/util/DynamicSchedulerUtil.java index 0d4883a7..891615e2 100644 --- a/xxl-job-admin/src/main/java/com/xxl/job/core/util/DynamicSchedulerUtil.java +++ b/xxl-job-admin/src/main/java/com/xxl/job/admin/core/util/DynamicSchedulerUtil.java @@ -1,4 +1,4 @@ -package com.xxl.job.core.util; +package com.xxl.job.admin.core.util; import java.util.ArrayList; import java.util.Date; @@ -31,11 +31,11 @@ import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContextAware; import org.springframework.util.Assert; -import com.xxl.job.client.util.JacksonUtil; -import com.xxl.job.core.callback.XxlJobCallbackServer; -import com.xxl.job.core.model.XxlJobInfo; -import com.xxl.job.dao.IXxlJobInfoDao; -import com.xxl.job.dao.IXxlJobLogDao; +import com.xxl.job.admin.core.callback.XxlJobLogCallbackServer; +import com.xxl.job.admin.core.model.XxlJobInfo; +import com.xxl.job.admin.dao.IXxlJobInfoDao; +import com.xxl.job.admin.dao.IXxlJobLogDao; +import com.xxl.job.core.util.JacksonUtil; /** * base quartz scheduler util @@ -60,7 +60,7 @@ public final class DynamicSchedulerUtil implements ApplicationContextAware, Init public void init(){ try { // start callback server - new XxlJobCallbackServer().start(callBackPort); + new XxlJobLogCallbackServer().start(callBackPort); } catch (Exception e) { e.printStackTrace(); } diff --git a/xxl-job-admin/src/main/java/com/xxl/job/core/util/MailUtil.java b/xxl-job-admin/src/main/java/com/xxl/job/admin/core/util/MailUtil.java similarity index 96% rename from xxl-job-admin/src/main/java/com/xxl/job/core/util/MailUtil.java rename to xxl-job-admin/src/main/java/com/xxl/job/admin/core/util/MailUtil.java index ff2204d5..edf77760 100644 --- a/xxl-job-admin/src/main/java/com/xxl/job/core/util/MailUtil.java +++ b/xxl-job-admin/src/main/java/com/xxl/job/admin/core/util/MailUtil.java @@ -1,4 +1,4 @@ -package com.xxl.job.core.util; +package com.xxl.job.admin.core.util; import java.io.File; import java.util.Properties; diff --git a/xxl-job-admin/src/main/java/com/xxl/job/core/util/PropertiesUtil.java b/xxl-job-admin/src/main/java/com/xxl/job/admin/core/util/PropertiesUtil.java similarity index 93% rename from xxl-job-admin/src/main/java/com/xxl/job/core/util/PropertiesUtil.java rename to xxl-job-admin/src/main/java/com/xxl/job/admin/core/util/PropertiesUtil.java index 2c51dd95..67f21250 100644 --- a/xxl-job-admin/src/main/java/com/xxl/job/core/util/PropertiesUtil.java +++ b/xxl-job-admin/src/main/java/com/xxl/job/admin/core/util/PropertiesUtil.java @@ -1,4 +1,4 @@ -package com.xxl.job.core.util; +package com.xxl.job.admin.core.util; import java.io.FileInputStream; import java.io.IOException; diff --git a/xxl-job-admin/src/main/java/com/xxl/job/dao/IXxlJobInfoDao.java b/xxl-job-admin/src/main/java/com/xxl/job/admin/dao/IXxlJobInfoDao.java similarity index 82% rename from xxl-job-admin/src/main/java/com/xxl/job/dao/IXxlJobInfoDao.java rename to xxl-job-admin/src/main/java/com/xxl/job/admin/dao/IXxlJobInfoDao.java index dc6e7430..972d1a65 100644 --- a/xxl-job-admin/src/main/java/com/xxl/job/dao/IXxlJobInfoDao.java +++ b/xxl-job-admin/src/main/java/com/xxl/job/admin/dao/IXxlJobInfoDao.java @@ -1,8 +1,9 @@ -package com.xxl.job.dao; +package com.xxl.job.admin.dao; import java.util.List; -import com.xxl.job.core.model.XxlJobInfo; +import com.xxl.job.admin.core.model.XxlJobInfo; + /** * job info diff --git a/xxl-job-admin/src/main/java/com/xxl/job/dao/IXxlJobLogDao.java b/xxl-job-admin/src/main/java/com/xxl/job/admin/dao/IXxlJobLogDao.java similarity index 87% rename from xxl-job-admin/src/main/java/com/xxl/job/dao/IXxlJobLogDao.java rename to xxl-job-admin/src/main/java/com/xxl/job/admin/dao/IXxlJobLogDao.java index 0aeab408..0791ad05 100644 --- a/xxl-job-admin/src/main/java/com/xxl/job/dao/IXxlJobLogDao.java +++ b/xxl-job-admin/src/main/java/com/xxl/job/admin/dao/IXxlJobLogDao.java @@ -1,9 +1,9 @@ -package com.xxl.job.dao; +package com.xxl.job.admin.dao; import java.util.Date; import java.util.List; -import com.xxl.job.core.model.XxlJobLog; +import com.xxl.job.admin.core.model.XxlJobLog; /** * job log diff --git a/xxl-job-admin/src/main/java/com/xxl/job/dao/IXxlJobLogGlueDao.java b/xxl-job-admin/src/main/java/com/xxl/job/admin/dao/IXxlJobLogGlueDao.java similarity index 78% rename from xxl-job-admin/src/main/java/com/xxl/job/dao/IXxlJobLogGlueDao.java rename to xxl-job-admin/src/main/java/com/xxl/job/admin/dao/IXxlJobLogGlueDao.java index 7051876d..8b556446 100644 --- a/xxl-job-admin/src/main/java/com/xxl/job/dao/IXxlJobLogGlueDao.java +++ b/xxl-job-admin/src/main/java/com/xxl/job/admin/dao/IXxlJobLogGlueDao.java @@ -1,8 +1,8 @@ -package com.xxl.job.dao; +package com.xxl.job.admin.dao; import java.util.List; -import com.xxl.job.core.model.XxlJobLogGlue; +import com.xxl.job.admin.core.model.XxlJobLogGlue; /** * job log for glue diff --git a/xxl-job-admin/src/main/java/com/xxl/job/dao/impl/XxlJobInfoDaoImpl.java b/xxl-job-admin/src/main/java/com/xxl/job/admin/dao/impl/XxlJobInfoDaoImpl.java similarity index 90% rename from xxl-job-admin/src/main/java/com/xxl/job/dao/impl/XxlJobInfoDaoImpl.java rename to xxl-job-admin/src/main/java/com/xxl/job/admin/dao/impl/XxlJobInfoDaoImpl.java index 3879cd57..c31f47de 100644 --- a/xxl-job-admin/src/main/java/com/xxl/job/dao/impl/XxlJobInfoDaoImpl.java +++ b/xxl-job-admin/src/main/java/com/xxl/job/admin/dao/impl/XxlJobInfoDaoImpl.java @@ -1,4 +1,4 @@ -package com.xxl.job.dao.impl; +package com.xxl.job.admin.dao.impl; import java.util.HashMap; import java.util.List; @@ -8,8 +8,8 @@ import javax.annotation.Resource; import org.mybatis.spring.SqlSessionTemplate; import org.springframework.stereotype.Repository; -import com.xxl.job.core.model.XxlJobInfo; -import com.xxl.job.dao.IXxlJobInfoDao; +import com.xxl.job.admin.core.model.XxlJobInfo; +import com.xxl.job.admin.dao.IXxlJobInfoDao; /** * job info diff --git a/xxl-job-admin/src/main/java/com/xxl/job/dao/impl/XxlJobLogDaoImpl.java b/xxl-job-admin/src/main/java/com/xxl/job/admin/dao/impl/XxlJobLogDaoImpl.java similarity index 93% rename from xxl-job-admin/src/main/java/com/xxl/job/dao/impl/XxlJobLogDaoImpl.java rename to xxl-job-admin/src/main/java/com/xxl/job/admin/dao/impl/XxlJobLogDaoImpl.java index 4fc7e5b0..4850718d 100644 --- a/xxl-job-admin/src/main/java/com/xxl/job/dao/impl/XxlJobLogDaoImpl.java +++ b/xxl-job-admin/src/main/java/com/xxl/job/admin/dao/impl/XxlJobLogDaoImpl.java @@ -1,4 +1,4 @@ -package com.xxl.job.dao.impl; +package com.xxl.job.admin.dao.impl; import java.util.Date; import java.util.HashMap; @@ -9,8 +9,8 @@ import javax.annotation.Resource; import org.mybatis.spring.SqlSessionTemplate; import org.springframework.stereotype.Repository; -import com.xxl.job.core.model.XxlJobLog; -import com.xxl.job.dao.IXxlJobLogDao; +import com.xxl.job.admin.core.model.XxlJobLog; +import com.xxl.job.admin.dao.IXxlJobLogDao; /** * job log diff --git a/xxl-job-admin/src/main/java/com/xxl/job/dao/impl/XxlJobLogGlueDaoImpl.java b/xxl-job-admin/src/main/java/com/xxl/job/admin/dao/impl/XxlJobLogGlueDaoImpl.java similarity index 88% rename from xxl-job-admin/src/main/java/com/xxl/job/dao/impl/XxlJobLogGlueDaoImpl.java rename to xxl-job-admin/src/main/java/com/xxl/job/admin/dao/impl/XxlJobLogGlueDaoImpl.java index 54bfde48..a1506b86 100644 --- a/xxl-job-admin/src/main/java/com/xxl/job/dao/impl/XxlJobLogGlueDaoImpl.java +++ b/xxl-job-admin/src/main/java/com/xxl/job/admin/dao/impl/XxlJobLogGlueDaoImpl.java @@ -1,4 +1,4 @@ -package com.xxl.job.dao.impl; +package com.xxl.job.admin.dao.impl; import java.util.HashMap; import java.util.List; @@ -8,8 +8,8 @@ import javax.annotation.Resource; import org.mybatis.spring.SqlSessionTemplate; import org.springframework.stereotype.Repository; -import com.xxl.job.core.model.XxlJobLogGlue; -import com.xxl.job.dao.IXxlJobLogGlueDao; +import com.xxl.job.admin.core.model.XxlJobLogGlue; +import com.xxl.job.admin.dao.IXxlJobLogGlueDao; /** * job log for glue diff --git a/xxl-job-admin/src/main/resources/applicationcontext-base.xml b/xxl-job-admin/src/main/resources/applicationcontext-base.xml index 70f74a44..f2147501 100644 --- a/xxl-job-admin/src/main/resources/applicationcontext-base.xml +++ b/xxl-job-admin/src/main/resources/applicationcontext-base.xml @@ -9,8 +9,7 @@ http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd"> - - + @@ -21,13 +20,4 @@ - - - - - classpath*:jdbc.properties - - - - \ No newline at end of file diff --git a/xxl-job-admin/src/main/resources/applicationcontext-database.xml b/xxl-job-admin/src/main/resources/applicationcontext-database.xml index 2a8bd8a3..a9370b8d 100644 --- a/xxl-job-admin/src/main/resources/applicationcontext-database.xml +++ b/xxl-job-admin/src/main/resources/applicationcontext-database.xml @@ -11,10 +11,18 @@ http://www.springframework.org/schema/aop/spring-aop-3.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd"> - - - + + + + + + + classpath*:jdbc.properties + + + + @@ -38,5 +46,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/xxl-job-admin/src/main/resources/applicationcontext-trigger-db.xml b/xxl-job-admin/src/main/resources/applicationcontext-trigger-db.xml index d6f32f15..e01d121e 100644 --- a/xxl-job-admin/src/main/resources/applicationcontext-trigger-db.xml +++ b/xxl-job-admin/src/main/resources/applicationcontext-trigger-db.xml @@ -18,7 +18,7 @@ - + diff --git a/xxl-job-admin/src/main/resources/applicationcontext-tx.xml b/xxl-job-admin/src/main/resources/applicationcontext-tx.xml deleted file mode 100644 index 709ad8ca..00000000 --- a/xxl-job-admin/src/main/resources/applicationcontext-tx.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/xxl-job-admin/src/main/resources/mybatis-mapper/XxlJobInfoMapper.xml b/xxl-job-admin/src/main/resources/mybatis-mapper/XxlJobInfoMapper.xml index ad1c24c3..7648e595 100644 --- a/xxl-job-admin/src/main/resources/mybatis-mapper/XxlJobInfoMapper.xml +++ b/xxl-job-admin/src/main/resources/mybatis-mapper/XxlJobInfoMapper.xml @@ -3,7 +3,7 @@ "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> - + @@ -71,7 +71,7 @@ - + INSERT INTO `xxl_job_qrtz_trigger_info` ( job_group, job_name, @@ -115,7 +115,7 @@ AND t.job_name = #{jobName} - + UPDATE `xxl_job_qrtz_trigger_info` SET job_cron = #{jobCron}, diff --git a/xxl-job-admin/src/main/resources/mybatis-mapper/XxlJobLogGlueMapper.xml b/xxl-job-admin/src/main/resources/mybatis-mapper/XxlJobLogGlueMapper.xml index 446b7464..5bc7a9f1 100644 --- a/xxl-job-admin/src/main/resources/mybatis-mapper/XxlJobLogGlueMapper.xml +++ b/xxl-job-admin/src/main/resources/mybatis-mapper/XxlJobLogGlueMapper.xml @@ -3,7 +3,7 @@ "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> - + @@ -23,7 +23,7 @@ t.update_time - + INSERT INTO `xxl_job_qrtz_trigger_logglue` ( `job_group`, `job_name`, diff --git a/xxl-job-admin/src/main/resources/mybatis-mapper/XxlJobLogMapper.xml b/xxl-job-admin/src/main/resources/mybatis-mapper/XxlJobLogMapper.xml index 5ec18856..7f0555d7 100644 --- a/xxl-job-admin/src/main/resources/mybatis-mapper/XxlJobLogMapper.xml +++ b/xxl-job-admin/src/main/resources/mybatis-mapper/XxlJobLogMapper.xml @@ -3,7 +3,7 @@ "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> - + @@ -91,7 +91,7 @@ AND t.job_name = #{jobName} - + INSERT INTO `xxl_job_qrtz_trigger_log` ( `job_group`, `job_name`, diff --git a/xxl-job-admin/src/main/resources/springmvc-context.xml b/xxl-job-admin/src/main/resources/springmvc-context.xml index 594e6b1c..48562037 100644 --- a/xxl-job-admin/src/main/resources/springmvc-context.xml +++ b/xxl-job-admin/src/main/resources/springmvc-context.xml @@ -19,7 +19,7 @@ http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd"> - + @@ -41,13 +41,13 @@ - + - + - + \ No newline at end of file diff --git a/xxl-job-admin/src/test/java/com/xxl/job/dao/impl/XxlJobInfoTest.java b/xxl-job-admin/src/test/java/com/xxl/job/dao/impl/XxlJobInfoTest.java index 4dd20d61..4e0baffd 100644 --- a/xxl-job-admin/src/test/java/com/xxl/job/dao/impl/XxlJobInfoTest.java +++ b/xxl-job-admin/src/test/java/com/xxl/job/dao/impl/XxlJobInfoTest.java @@ -9,8 +9,8 @@ import org.junit.runner.RunWith; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import com.xxl.job.core.model.XxlJobInfo; -import com.xxl.job.dao.IXxlJobInfoDao; +import com.xxl.job.admin.core.model.XxlJobInfo; +import com.xxl.job.admin.dao.IXxlJobInfoDao; @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = "classpath*:applicationcontext-*.xml") diff --git a/xxl-job-admin/src/test/java/com/xxl/job/dao/impl/XxlJobLogTest.java b/xxl-job-admin/src/test/java/com/xxl/job/dao/impl/XxlJobLogTest.java index b56d7b0b..8f0a4216 100644 --- a/xxl-job-admin/src/test/java/com/xxl/job/dao/impl/XxlJobLogTest.java +++ b/xxl-job-admin/src/test/java/com/xxl/job/dao/impl/XxlJobLogTest.java @@ -10,10 +10,10 @@ import org.junit.runner.RunWith; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import com.xxl.job.client.handler.IJobHandler; -import com.xxl.job.client.util.HttpUtil.RemoteCallBack; -import com.xxl.job.core.model.XxlJobLog; -import com.xxl.job.dao.IXxlJobLogDao; +import com.xxl.job.admin.core.model.XxlJobLog; +import com.xxl.job.admin.dao.IXxlJobLogDao; +import com.xxl.job.core.handler.IJobHandler; +import com.xxl.job.core.util.HttpUtil.RemoteCallBack; @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = "classpath*:applicationcontext-*.xml") diff --git a/xxl-job-client-demo/src/main/java/com/xxl/job/service/handler/DemoJobHandler.java b/xxl-job-client-demo/src/main/java/com/xxl/job/service/handler/DemoJobHandler.java deleted file mode 100644 index d52b5e58..00000000 --- a/xxl-job-client-demo/src/main/java/com/xxl/job/service/handler/DemoJobHandler.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.xxl.job.service.handler; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.stereotype.Service; - -import com.xxl.job.client.handler.IJobHandler; -import com.xxl.job.client.handler.annotation.JobHander; - -/** - * demo job handler - * @author xuxueli 2015-12-19 19:43:36 - */ -@JobHander(name="demoJobHandler") -@Service -public class DemoJobHandler extends IJobHandler { - private static transient Logger logger = LoggerFactory.getLogger(DemoJobHandler.class); - - @Override - public JobHandleStatus handle(String... params) throws Exception { - logger.info("XXL-JOB, Hello World."); - return JobHandleStatus.SUCCESS; - } - -} diff --git a/xxl-job-client/.gitignore b/xxl-job-core/.gitignore similarity index 87% rename from xxl-job-client/.gitignore rename to xxl-job-core/.gitignore index 5c6b4658..fa586f84 100644 --- a/xxl-job-client/.gitignore +++ b/xxl-job-core/.gitignore @@ -3,3 +3,4 @@ /.project /.settings/ /xxl-job-client.iml +/target/ diff --git a/xxl-job-client/pom.xml b/xxl-job-core/pom.xml similarity index 94% rename from xxl-job-client/pom.xml rename to xxl-job-core/pom.xml index d0e1f24c..6b20e945 100644 --- a/xxl-job-client/pom.xml +++ b/xxl-job-core/pom.xml @@ -6,7 +6,7 @@ xxl-job 1.3.0-SNAPSHOT - xxl-job-client + xxl-job-core 1.3.1 diff --git a/xxl-job-client/src/main/java/com/xxl/job/client/netcom/jetty/XxlJobJettyServer.java b/xxl-job-core/src/main/java/com/xxl/job/core/executor/jetty/XxlJobExecutor.java similarity index 82% rename from xxl-job-client/src/main/java/com/xxl/job/client/netcom/jetty/XxlJobJettyServer.java rename to xxl-job-core/src/main/java/com/xxl/job/core/executor/jetty/XxlJobExecutor.java index d4bba2f1..073f21cc 100644 --- a/xxl-job-client/src/main/java/com/xxl/job/client/netcom/jetty/XxlJobJettyServer.java +++ b/xxl-job-core/src/main/java/com/xxl/job/core/executor/jetty/XxlJobExecutor.java @@ -1,4 +1,4 @@ -package com.xxl.job.client.netcom.jetty; +package com.xxl.job.core.executor.jetty; import java.util.Map; @@ -14,15 +14,15 @@ import org.springframework.beans.BeansException; import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContextAware; -import com.xxl.job.client.handler.HandlerRepository; -import com.xxl.job.client.handler.IJobHandler; -import com.xxl.job.client.handler.annotation.JobHander; +import com.xxl.job.core.handler.HandlerRepository; +import com.xxl.job.core.handler.IJobHandler; +import com.xxl.job.core.handler.annotation.JobHander; /** * Created by xuxueli on 2016/3/2 21:14. */ -public class XxlJobJettyServer implements ApplicationContextAware { - private static final Logger logger = LoggerFactory.getLogger(XxlJobJettyServer.class); +public class XxlJobExecutor implements ApplicationContextAware { + private static final Logger logger = LoggerFactory.getLogger(XxlJobExecutor.class); private int port = 9999; public void setPort(int port) { @@ -45,7 +45,7 @@ public class XxlJobJettyServer implements ApplicationContextAware { // handler HandlerCollection handlerc =new HandlerCollection(); - handlerc.setHandlers(new Handler[]{new XxlJobJettyServerHandler()}); + handlerc.setHandlers(new Handler[]{new XxlJobExecutorHandler()}); server.setHandler(handlerc); try { @@ -64,7 +64,7 @@ public class XxlJobJettyServer implements ApplicationContextAware { public static ApplicationContext applicationContext; @Override public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { - XxlJobJettyServer.applicationContext = applicationContext; + XxlJobExecutor.applicationContext = applicationContext; initJobHandler(); } @@ -72,7 +72,7 @@ public class XxlJobJettyServer implements ApplicationContextAware { * init job handler service */ public void initJobHandler(){ - Map serviceBeanMap = XxlJobJettyServer.applicationContext.getBeansWithAnnotation(JobHander.class); + Map serviceBeanMap = XxlJobExecutor.applicationContext.getBeansWithAnnotation(JobHander.class); if (serviceBeanMap!=null && serviceBeanMap.size()>0) { for (Object serviceBean : serviceBeanMap.values()) { String jobName = serviceBean.getClass().getAnnotation(JobHander.class).name(); diff --git a/xxl-job-client/src/main/java/com/xxl/job/client/netcom/jetty/XxlJobJettyServerHandler.java b/xxl-job-core/src/main/java/com/xxl/job/core/executor/jetty/XxlJobExecutorHandler.java similarity index 89% rename from xxl-job-client/src/main/java/com/xxl/job/client/netcom/jetty/XxlJobJettyServerHandler.java rename to xxl-job-core/src/main/java/com/xxl/job/core/executor/jetty/XxlJobExecutorHandler.java index c223ce54..c26d6e60 100644 --- a/xxl-job-client/src/main/java/com/xxl/job/client/netcom/jetty/XxlJobJettyServerHandler.java +++ b/xxl-job-core/src/main/java/com/xxl/job/core/executor/jetty/XxlJobExecutorHandler.java @@ -1,6 +1,6 @@ -package com.xxl.job.client.netcom.jetty; +package com.xxl.job.core.executor.jetty; -import com.xxl.job.client.handler.HandlerRepository; +import com.xxl.job.core.handler.HandlerRepository; import org.eclipse.jetty.server.Request; import org.eclipse.jetty.server.handler.AbstractHandler; @@ -14,7 +14,7 @@ import java.util.Map; /** * Created by xuxueli on 2016/3/2 21:23. */ -public class XxlJobJettyServerHandler extends AbstractHandler { +public class XxlJobExecutorHandler extends AbstractHandler { @Override public void handle(String s, Request baseRequest, HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws IOException, ServletException { diff --git a/xxl-job-client/src/main/java/com/xxl/job/client/netcom/servlet/XxlJobServlet.java b/xxl-job-core/src/main/java/com/xxl/job/core/executor/servlet/XxlJobServlet.java similarity index 100% rename from xxl-job-client/src/main/java/com/xxl/job/client/netcom/servlet/XxlJobServlet.java rename to xxl-job-core/src/main/java/com/xxl/job/core/executor/servlet/XxlJobServlet.java diff --git a/xxl-job-client/src/main/java/com/xxl/job/client/glue/GlueFactory.java b/xxl-job-core/src/main/java/com/xxl/job/core/glue/GlueFactory.java similarity index 92% rename from xxl-job-client/src/main/java/com/xxl/job/client/glue/GlueFactory.java rename to xxl-job-core/src/main/java/com/xxl/job/core/glue/GlueFactory.java index 795b1d09..652d073f 100644 --- a/xxl-job-client/src/main/java/com/xxl/job/client/glue/GlueFactory.java +++ b/xxl-job-core/src/main/java/com/xxl/job/core/glue/GlueFactory.java @@ -1,4 +1,4 @@ -package com.xxl.job.client.glue; +package com.xxl.job.core.glue; import java.lang.reflect.Field; import java.lang.reflect.Modifier; @@ -13,10 +13,10 @@ import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContextAware; import org.springframework.core.annotation.AnnotationUtils; -import com.xxl.job.client.glue.cache.LocalCache; -import com.xxl.job.client.glue.loader.GlueLoader; -import com.xxl.job.client.handler.IJobHandler; -import com.xxl.job.client.handler.IJobHandler.JobHandleStatus; +import com.xxl.job.core.glue.cache.LocalCache; +import com.xxl.job.core.glue.loader.GlueLoader; +import com.xxl.job.core.handler.IJobHandler; +import com.xxl.job.core.handler.IJobHandler.JobHandleStatus; import groovy.lang.GroovyClassLoader; @@ -158,7 +158,7 @@ public class GlueFactory implements ApplicationContextAware { // ----------------------------- util ----------------------------- public static JobHandleStatus glue(String job_group, String job_name, String... params) throws Exception{ - return GlueFactory.glueFactory.loadInstance(job_group, job_name).handle(params); + return GlueFactory.glueFactory.loadInstance(job_group, job_name).execute(params); } } diff --git a/xxl-job-client/src/main/java/com/xxl/job/client/glue/cache/ICache.java b/xxl-job-core/src/main/java/com/xxl/job/core/glue/cache/ICache.java similarity index 83% rename from xxl-job-client/src/main/java/com/xxl/job/client/glue/cache/ICache.java rename to xxl-job-core/src/main/java/com/xxl/job/core/glue/cache/ICache.java index 92362a85..963a67a5 100644 --- a/xxl-job-client/src/main/java/com/xxl/job/client/glue/cache/ICache.java +++ b/xxl-job-core/src/main/java/com/xxl/job/core/glue/cache/ICache.java @@ -1,4 +1,4 @@ -package com.xxl.job.client.glue.cache; +package com.xxl.job.core.glue.cache; /** * chche interface diff --git a/xxl-job-client/src/main/java/com/xxl/job/client/glue/cache/LocalCache.java b/xxl-job-core/src/main/java/com/xxl/job/core/glue/cache/LocalCache.java similarity index 94% rename from xxl-job-client/src/main/java/com/xxl/job/client/glue/cache/LocalCache.java rename to xxl-job-core/src/main/java/com/xxl/job/core/glue/cache/LocalCache.java index 1007d2a1..85dc249a 100644 --- a/xxl-job-client/src/main/java/com/xxl/job/client/glue/cache/LocalCache.java +++ b/xxl-job-core/src/main/java/com/xxl/job/core/glue/cache/LocalCache.java @@ -1,4 +1,4 @@ -package com.xxl.job.client.glue.cache; +package com.xxl.job.core.glue.cache; import java.util.concurrent.ConcurrentHashMap; diff --git a/xxl-job-client/src/main/java/com/xxl/job/client/glue/loader/GlueLoader.java b/xxl-job-core/src/main/java/com/xxl/job/core/glue/loader/GlueLoader.java similarity index 82% rename from xxl-job-client/src/main/java/com/xxl/job/client/glue/loader/GlueLoader.java rename to xxl-job-core/src/main/java/com/xxl/job/core/glue/loader/GlueLoader.java index 668c0c20..b210e28e 100644 --- a/xxl-job-client/src/main/java/com/xxl/job/client/glue/loader/GlueLoader.java +++ b/xxl-job-core/src/main/java/com/xxl/job/core/glue/loader/GlueLoader.java @@ -1,4 +1,4 @@ -package com.xxl.job.client.glue.loader; +package com.xxl.job.core.glue.loader; /** * code source loader diff --git a/xxl-job-client/src/main/java/com/xxl/job/client/handler/HandlerRepository.java b/xxl-job-core/src/main/java/com/xxl/job/core/handler/HandlerRepository.java similarity index 94% rename from xxl-job-client/src/main/java/com/xxl/job/client/handler/HandlerRepository.java rename to xxl-job-core/src/main/java/com/xxl/job/core/handler/HandlerRepository.java index b1e61f5f..a31110f1 100644 --- a/xxl-job-client/src/main/java/com/xxl/job/client/handler/HandlerRepository.java +++ b/xxl-job-core/src/main/java/com/xxl/job/core/handler/HandlerRepository.java @@ -1,4 +1,4 @@ -package com.xxl.job.client.handler; +package com.xxl.job.core.handler; import java.util.Date; import java.util.Map; @@ -7,10 +7,10 @@ import java.util.concurrent.ConcurrentHashMap; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import com.xxl.job.client.handler.impl.GlueJobHandler; -import com.xxl.job.client.log.XxlJobFileAppender; -import com.xxl.job.client.util.HttpUtil.RemoteCallBack; -import com.xxl.job.client.util.JacksonUtil; +import com.xxl.job.core.handler.impl.GlueJobHandler; +import com.xxl.job.core.log.XxlJobFileAppender; +import com.xxl.job.core.util.HttpUtil.RemoteCallBack; +import com.xxl.job.core.util.JacksonUtil; /** * handler repository diff --git a/xxl-job-client/src/main/java/com/xxl/job/client/handler/HandlerThread.java b/xxl-job-core/src/main/java/com/xxl/job/core/handler/HandlerThread.java similarity index 90% rename from xxl-job-client/src/main/java/com/xxl/job/client/handler/HandlerThread.java rename to xxl-job-core/src/main/java/com/xxl/job/core/handler/HandlerThread.java index f792dff0..53f16c1b 100644 --- a/xxl-job-client/src/main/java/com/xxl/job/client/handler/HandlerThread.java +++ b/xxl-job-core/src/main/java/com/xxl/job/core/handler/HandlerThread.java @@ -1,4 +1,4 @@ -package com.xxl.job.client.handler; +package com.xxl.job.core.handler; import java.io.PrintWriter; import java.io.StringWriter; @@ -11,10 +11,10 @@ import org.eclipse.jetty.util.ConcurrentHashSet; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import com.xxl.job.client.handler.IJobHandler.JobHandleStatus; -import com.xxl.job.client.log.XxlJobFileAppender; -import com.xxl.job.client.util.HttpUtil; -import com.xxl.job.client.util.HttpUtil.RemoteCallBack; +import com.xxl.job.core.handler.IJobHandler.JobHandleStatus; +import com.xxl.job.core.log.XxlJobFileAppender; +import com.xxl.job.core.util.HttpUtil; +import com.xxl.job.core.util.HttpUtil.RemoteCallBack; /** * handler thread @@ -79,7 +79,7 @@ public class HandlerThread extends Thread{ try { XxlJobFileAppender.contextHolder.set(trigger_log_id); logger.info(">>>>>>>>>>> xxl-job handle start."); - _status = handler.handle(handlerParams); + _status = handler.execute(handlerParams); } catch (Exception e) { logger.info("HandlerThread Exception:", e); StringWriter out = new StringWriter(); diff --git a/xxl-job-client/src/main/java/com/xxl/job/client/handler/IJobHandler.java b/xxl-job-core/src/main/java/com/xxl/job/core/handler/IJobHandler.java similarity index 75% rename from xxl-job-client/src/main/java/com/xxl/job/client/handler/IJobHandler.java rename to xxl-job-core/src/main/java/com/xxl/job/core/handler/IJobHandler.java index ed40592d..a1e21bbc 100644 --- a/xxl-job-client/src/main/java/com/xxl/job/client/handler/IJobHandler.java +++ b/xxl-job-core/src/main/java/com/xxl/job/core/handler/IJobHandler.java @@ -1,4 +1,4 @@ -package com.xxl.job.client.handler; +package com.xxl.job.core.handler; /** * remote job handler @@ -13,7 +13,7 @@ public abstract class IJobHandler extends HandlerRepository{ * @return * @throws Exception */ - public abstract JobHandleStatus handle(String... params) throws Exception; + public abstract JobHandleStatus execute(String... params) throws Exception; public static enum JobHandleStatus{ /** diff --git a/xxl-job-client/src/main/java/com/xxl/job/client/handler/annotation/JobHander.java b/xxl-job-core/src/main/java/com/xxl/job/core/handler/annotation/JobHander.java similarity index 88% rename from xxl-job-client/src/main/java/com/xxl/job/client/handler/annotation/JobHander.java rename to xxl-job-core/src/main/java/com/xxl/job/core/handler/annotation/JobHander.java index 66e3a7eb..4ec6ac8b 100644 --- a/xxl-job-client/src/main/java/com/xxl/job/client/handler/annotation/JobHander.java +++ b/xxl-job-core/src/main/java/com/xxl/job/core/handler/annotation/JobHander.java @@ -1,4 +1,4 @@ -package com.xxl.job.client.handler.annotation; +package com.xxl.job.core.handler.annotation; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; diff --git a/xxl-job-client/src/main/java/com/xxl/job/client/handler/impl/GlueJobHandler.java b/xxl-job-core/src/main/java/com/xxl/job/core/handler/impl/GlueJobHandler.java similarity index 62% rename from xxl-job-client/src/main/java/com/xxl/job/client/handler/impl/GlueJobHandler.java rename to xxl-job-core/src/main/java/com/xxl/job/core/handler/impl/GlueJobHandler.java index c6d0ea12..1a3062bf 100644 --- a/xxl-job-client/src/main/java/com/xxl/job/client/handler/impl/GlueJobHandler.java +++ b/xxl-job-core/src/main/java/com/xxl/job/core/handler/impl/GlueJobHandler.java @@ -1,7 +1,7 @@ -package com.xxl.job.client.handler.impl; +package com.xxl.job.core.handler.impl; -import com.xxl.job.client.glue.GlueFactory; -import com.xxl.job.client.handler.IJobHandler; +import com.xxl.job.core.glue.GlueFactory; +import com.xxl.job.core.handler.IJobHandler; /** * glue job handler @@ -17,7 +17,7 @@ public class GlueJobHandler extends IJobHandler { } @Override - public JobHandleStatus handle(String... params) throws Exception { + public JobHandleStatus execute(String... params) throws Exception { return GlueFactory.glue(job_group, job_name, params); } diff --git a/xxl-job-client/src/main/java/com/xxl/job/client/log/XxlJobFileAppender.java b/xxl-job-core/src/main/java/com/xxl/job/core/log/XxlJobFileAppender.java similarity index 99% rename from xxl-job-client/src/main/java/com/xxl/job/client/log/XxlJobFileAppender.java rename to xxl-job-core/src/main/java/com/xxl/job/core/log/XxlJobFileAppender.java index 625f437f..f549f886 100644 --- a/xxl-job-client/src/main/java/com/xxl/job/client/log/XxlJobFileAppender.java +++ b/xxl-job-core/src/main/java/com/xxl/job/core/log/XxlJobFileAppender.java @@ -1,4 +1,4 @@ -package com.xxl.job.client.log; +package com.xxl.job.core.log; import java.io.BufferedReader; import java.io.File; diff --git a/xxl-job-client/src/main/java/com/xxl/job/client/util/HttpUtil.java b/xxl-job-core/src/main/java/com/xxl/job/core/util/HttpUtil.java similarity index 95% rename from xxl-job-client/src/main/java/com/xxl/job/client/util/HttpUtil.java rename to xxl-job-core/src/main/java/com/xxl/job/core/util/HttpUtil.java index 0ccbb4f8..493941f8 100644 --- a/xxl-job-client/src/main/java/com/xxl/job/client/util/HttpUtil.java +++ b/xxl-job-core/src/main/java/com/xxl/job/core/util/HttpUtil.java @@ -1,4 +1,4 @@ -package com.xxl.job.client.util; +package com.xxl.job.core.util; import java.io.IOException; import java.io.PrintWriter; diff --git a/xxl-job-client/src/main/java/com/xxl/job/client/util/IpUtil.java b/xxl-job-core/src/main/java/com/xxl/job/core/util/IpUtil.java similarity index 94% rename from xxl-job-client/src/main/java/com/xxl/job/client/util/IpUtil.java rename to xxl-job-core/src/main/java/com/xxl/job/core/util/IpUtil.java index 32531b2d..7579d1f1 100644 --- a/xxl-job-client/src/main/java/com/xxl/job/client/util/IpUtil.java +++ b/xxl-job-core/src/main/java/com/xxl/job/core/util/IpUtil.java @@ -1,4 +1,4 @@ -package com.xxl.job.client.util; +package com.xxl.job.core.util; import java.net.InetAddress; import java.net.NetworkInterface; diff --git a/xxl-job-client/src/main/java/com/xxl/job/client/util/JacksonUtil.java b/xxl-job-core/src/main/java/com/xxl/job/core/util/JacksonUtil.java similarity index 94% rename from xxl-job-client/src/main/java/com/xxl/job/client/util/JacksonUtil.java rename to xxl-job-core/src/main/java/com/xxl/job/core/util/JacksonUtil.java index f36219bf..d6ffbae0 100644 --- a/xxl-job-client/src/main/java/com/xxl/job/client/util/JacksonUtil.java +++ b/xxl-job-core/src/main/java/com/xxl/job/core/util/JacksonUtil.java @@ -1,4 +1,4 @@ -package com.xxl.job.client.util; +package com.xxl.job.core.util; import java.io.IOException; diff --git a/xxl-job-client-demo/.gitignore b/xxl-job-executor-example/.gitignore similarity index 88% rename from xxl-job-client-demo/.gitignore rename to xxl-job-executor-example/.gitignore index d5cf4a3e..c639e6bc 100644 --- a/xxl-job-client-demo/.gitignore +++ b/xxl-job-executor-example/.gitignore @@ -3,3 +3,4 @@ /.project /.settings/ /xxl-job-client-demo.iml +/target/ diff --git a/xxl-job-client-demo/pom.xml b/xxl-job-executor-example/pom.xml similarity index 92% rename from xxl-job-client-demo/pom.xml rename to xxl-job-executor-example/pom.xml index 2e630ce1..b65fac6b 100644 --- a/xxl-job-client-demo/pom.xml +++ b/xxl-job-executor-example/pom.xml @@ -6,7 +6,7 @@ xxl-job 1.3.0-SNAPSHOT - xxl-job-client-demo + xxl-job-executor-example 1.3.1-SNAPSHOT war @@ -75,10 +75,10 @@ 5.1.29 - + com.xxl - xxl-job-client + xxl-job-core 1.3.1 diff --git a/xxl-job-client-demo/src/main/java/com/xxl/job/service/loader/DbGlueLoader.java b/xxl-job-executor-example/src/main/java/com/xxl/job/executor/loader/DbGlueLoader.java similarity index 55% rename from xxl-job-client-demo/src/main/java/com/xxl/job/service/loader/DbGlueLoader.java rename to xxl-job-executor-example/src/main/java/com/xxl/job/executor/loader/DbGlueLoader.java index bb855567..46408387 100644 --- a/xxl-job-client-demo/src/main/java/com/xxl/job/service/loader/DbGlueLoader.java +++ b/xxl-job-executor-example/src/main/java/com/xxl/job/executor/loader/DbGlueLoader.java @@ -1,13 +1,17 @@ -package com.xxl.job.service.loader; +package com.xxl.job.executor.loader; import javax.annotation.Resource; import org.springframework.stereotype.Service; -import com.xxl.job.client.glue.loader.GlueLoader; -import com.xxl.job.dao.IXxlJobInfoDao; -import com.xxl.job.dao.model.XxlJobInfo; +import com.xxl.job.core.glue.loader.GlueLoader; +import com.xxl.job.executor.loader.dao.IXxlJobInfoDao; +import com.xxl.job.executor.loader.dao.model.XxlJobInfo; +/** + * GLUE 代码加载器,推荐将该服务配置成RPC服务 + * @author xuxueli + */ @Service("dbGlueLoader") public class DbGlueLoader implements GlueLoader { diff --git a/xxl-job-client-demo/src/main/java/com/xxl/job/dao/IXxlJobInfoDao.java b/xxl-job-executor-example/src/main/java/com/xxl/job/executor/loader/dao/IXxlJobInfoDao.java similarity index 59% rename from xxl-job-client-demo/src/main/java/com/xxl/job/dao/IXxlJobInfoDao.java rename to xxl-job-executor-example/src/main/java/com/xxl/job/executor/loader/dao/IXxlJobInfoDao.java index 8d98d490..a93b7648 100644 --- a/xxl-job-client-demo/src/main/java/com/xxl/job/dao/IXxlJobInfoDao.java +++ b/xxl-job-executor-example/src/main/java/com/xxl/job/executor/loader/dao/IXxlJobInfoDao.java @@ -1,6 +1,6 @@ -package com.xxl.job.dao; +package com.xxl.job.executor.loader.dao; -import com.xxl.job.dao.model.XxlJobInfo; +import com.xxl.job.executor.loader.dao.model.XxlJobInfo; /** * job log for glue diff --git a/xxl-job-client-demo/src/main/java/com/xxl/job/dao/impl/XxlJobInfoDaoImpl.java b/xxl-job-executor-example/src/main/java/com/xxl/job/executor/loader/dao/impl/XxlJobInfoDaoImpl.java similarity index 77% rename from xxl-job-client-demo/src/main/java/com/xxl/job/dao/impl/XxlJobInfoDaoImpl.java rename to xxl-job-executor-example/src/main/java/com/xxl/job/executor/loader/dao/impl/XxlJobInfoDaoImpl.java index 6cb2aaba..3aba909f 100644 --- a/xxl-job-client-demo/src/main/java/com/xxl/job/dao/impl/XxlJobInfoDaoImpl.java +++ b/xxl-job-executor-example/src/main/java/com/xxl/job/executor/loader/dao/impl/XxlJobInfoDaoImpl.java @@ -1,4 +1,4 @@ -package com.xxl.job.dao.impl; +package com.xxl.job.executor.loader.dao.impl; import java.util.HashMap; @@ -7,8 +7,9 @@ import javax.annotation.Resource; import org.mybatis.spring.SqlSessionTemplate; import org.springframework.stereotype.Repository; -import com.xxl.job.dao.IXxlJobInfoDao; -import com.xxl.job.dao.model.XxlJobInfo; +import com.xxl.job.executor.loader.dao.IXxlJobInfoDao; +import com.xxl.job.executor.loader.dao.model.XxlJobInfo; + /** * job log for glue diff --git a/xxl-job-client-demo/src/main/java/com/xxl/job/dao/model/XxlJobInfo.java b/xxl-job-executor-example/src/main/java/com/xxl/job/executor/loader/dao/model/XxlJobInfo.java similarity index 87% rename from xxl-job-client-demo/src/main/java/com/xxl/job/dao/model/XxlJobInfo.java rename to xxl-job-executor-example/src/main/java/com/xxl/job/executor/loader/dao/model/XxlJobInfo.java index 0a75a5a0..ccab5767 100644 --- a/xxl-job-client-demo/src/main/java/com/xxl/job/dao/model/XxlJobInfo.java +++ b/xxl-job-executor-example/src/main/java/com/xxl/job/executor/loader/dao/model/XxlJobInfo.java @@ -1,4 +1,4 @@ -package com.xxl.job.dao.model; +package com.xxl.job.executor.loader.dao.model; /** * xxl-job info 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 new file mode 100644 index 00000000..c28dce97 --- /dev/null +++ b/xxl-job-executor-example/src/main/java/com/xxl/job/executor/service/jobhandler/DemoJobHandler.java @@ -0,0 +1,32 @@ +package com.xxl.job.executor.service.jobhandler; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Service; + +import com.xxl.job.core.handler.IJobHandler; +import com.xxl.job.core.handler.annotation.JobHander; + + +/** + * 任务Handler的一个Demo(Bean模式) + * + * 开发步骤: + * 1、继承 “IJobHandler” ; + * 2、转配到Spring,例如加 “@Service” 注解; + * 3、加 “@JobHander” 注解,自定义属性name的值;name值在配置新任务是使用; + * + * @author xuxueli 2015-12-19 19:43:36 + */ +@JobHander(name="demoJobHandler") +@Service +public class DemoJobHandler extends IJobHandler { + private static transient Logger logger = LoggerFactory.getLogger(DemoJobHandler.class); + + @Override + public JobHandleStatus execute(String... params) throws Exception { + logger.info("XXL-JOB, Hello World."); + return JobHandleStatus.SUCCESS; + } + +} diff --git a/xxl-job-client-demo/src/main/resources/applicationcontext-database.xml b/xxl-job-executor-example/src/main/resources/applicationcontext-database.xml similarity index 94% rename from xxl-job-client-demo/src/main/resources/applicationcontext-database.xml rename to xxl-job-executor-example/src/main/resources/applicationcontext-database.xml index 34a0bcc5..afbdd68d 100644 --- a/xxl-job-client-demo/src/main/resources/applicationcontext-database.xml +++ b/xxl-job-executor-example/src/main/resources/applicationcontext-database.xml @@ -12,8 +12,6 @@ http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd"> - - diff --git a/xxl-job-client-demo/src/main/resources/applicationcontext-xxl-job.xml b/xxl-job-executor-example/src/main/resources/applicationcontext-xxl-job.xml similarity index 67% rename from xxl-job-client-demo/src/main/resources/applicationcontext-xxl-job.xml rename to xxl-job-executor-example/src/main/resources/applicationcontext-xxl-job.xml index 136a10bf..21a62e16 100644 --- a/xxl-job-client-demo/src/main/resources/applicationcontext-xxl-job.xml +++ b/xxl-job-executor-example/src/main/resources/applicationcontext-xxl-job.xml @@ -9,16 +9,16 @@ http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd"> - + - + - + - + \ No newline at end of file diff --git a/xxl-job-client-demo/src/main/resources/jdbc.properties b/xxl-job-executor-example/src/main/resources/jdbc.properties similarity index 100% rename from xxl-job-client-demo/src/main/resources/jdbc.properties rename to xxl-job-executor-example/src/main/resources/jdbc.properties diff --git a/xxl-job-client-demo/src/main/resources/log4j.xml b/xxl-job-executor-example/src/main/resources/log4j.xml similarity index 94% rename from xxl-job-client-demo/src/main/resources/log4j.xml rename to xxl-job-executor-example/src/main/resources/log4j.xml index 6d2ed198..7e707e38 100644 --- a/xxl-job-client-demo/src/main/resources/log4j.xml +++ b/xxl-job-executor-example/src/main/resources/log4j.xml @@ -18,7 +18,7 @@ - + diff --git a/xxl-job-client-demo/src/main/resources/mybatis-mapper/XxlJobInfoMapper.xml b/xxl-job-executor-example/src/main/resources/mybatis-mapper/XxlJobInfoMapper.xml similarity index 85% rename from xxl-job-client-demo/src/main/resources/mybatis-mapper/XxlJobInfoMapper.xml rename to xxl-job-executor-example/src/main/resources/mybatis-mapper/XxlJobInfoMapper.xml index e56045aa..e7ad41c7 100644 --- a/xxl-job-client-demo/src/main/resources/mybatis-mapper/XxlJobInfoMapper.xml +++ b/xxl-job-executor-example/src/main/resources/mybatis-mapper/XxlJobInfoMapper.xml @@ -3,7 +3,7 @@ "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> - + diff --git a/xxl-job-client-demo/src/main/webapp/WEB-INF/web.xml b/xxl-job-executor-example/src/main/webapp/WEB-INF/web.xml similarity index 100% rename from xxl-job-client-demo/src/main/webapp/WEB-INF/web.xml rename to xxl-job-executor-example/src/main/webapp/WEB-INF/web.xml diff --git a/xxl-job-client-demo/src/main/webapp/index.html b/xxl-job-executor-example/src/main/webapp/index.html similarity index 100% rename from xxl-job-client-demo/src/main/webapp/index.html rename to xxl-job-executor-example/src/main/webapp/index.html