Skip to content

Commit

Permalink
版本大升级v1.2.0,关键字如下:1、任务组;2、“远程任务”、“本地任务”;3、“任务日志”;4、“串行执行”,并行执行;
Browse files Browse the repository at this point in the history
  • Loading branch information
xueli.xue committed Jan 16, 2016
1 parent dc0011c commit 88352a7
Show file tree
Hide file tree
Showing 164 changed files with 318 additions and 40,241 deletions.
25 changes: 14 additions & 11 deletions doc/db/tables_xxl_log.sql
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
# DROP TABLE IF EXISTS XXL_JOB_QRTZ_TRIGGERS;
# DROP TABLE IF EXISTS XXL_JOB_QRTZ_JOB_DETAILS;
# DROP TABLE IF EXISTS XXL_JOB_QRTZ_CALENDARS;
# DROP TABLE IF EXISTS `xxl_job_qrtz_trigger_log`;
# DROP TABLE IF EXISTS `xxl_job_qrtz_trigger_info`;
# DROP TABLE IF EXISTS `xxl_job_qrtz_trigger_log`;

CREATE TABLE XXL_JOB_QRTZ_JOB_DETAILS
(
Expand Down Expand Up @@ -157,29 +157,32 @@ CREATE TABLE XXL_JOB_QRTZ_LOCKS
);


CREATE TABLE `xxl_job_qrtz_trigger_log` (
DROP TABLE IF EXISTS `xxl_job_qrtz_trigger_info`;
CREATE TABLE `xxl_job_qrtz_trigger_info` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`job_group` varchar(255) NOT NULL COMMENT '任务组',
`job_name` varchar(255) NOT NULL COMMENT '任务名',
`job_cron` varchar(128) NOT NULL COMMENT '任务执行CORN表达式',
`job_cron` varchar(128) NOT NULL COMMENT '任务执行CORN',
`job_desc` varchar(255) NOT NULL,
`job_class` varchar(255) NOT NULL COMMENT '任务执行JobBean',
`job_data` varchar(2048) DEFAULT NULL COMMENT '任务执行数据',
`trigger_time` datetime DEFAULT NULL COMMENT '调度-时间',
`trigger_status` varchar(255) DEFAULT NULL COMMENT '调度-结果',
`trigger_msg` varchar(2048) DEFAULT NULL COMMENT '调度-日志',
`handle_time` datetime DEFAULT NULL COMMENT '执行-时间',
`handle_status` varchar(255) DEFAULT NULL COMMENT '执行-状态',
`handle_msg` varchar(2048) DEFAULT NULL COMMENT '执行-日志',
`job_data` varchar(512) DEFAULT NULL COMMENT '任务执行数据',
`add_time` datetime DEFAULT NULL,
`update_time` datetime DEFAULT NULL,
`author` varchar(64) DEFAULT NULL COMMENT '作者',
`alarm_email` varchar(255) DEFAULT NULL COMMENT '报警邮件',
`alarm_threshold` int(11) DEFAULT NULL COMMENT '报警阀值(连续失败次数)',
PRIMARY KEY (`id`)
);

DROP TABLE IF EXISTS `xxl_job_qrtz_trigger_log`;
CREATE TABLE `xxl_job_qrtz_trigger_log` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`job_group` varchar(255) NOT NULL COMMENT '任务组',
`job_name` varchar(255) NOT NULL COMMENT '任务名',
`job_cron` varchar(128) NOT NULL COMMENT '任务执行CORN表达式',
`job_desc` varchar(255) NOT NULL,
`job_class` varchar(255) NOT NULL COMMENT '任务执行JobBean',
`job_data` varchar(2048) DEFAULT NULL COMMENT '任务执行数据',
`job_data` varchar(512) DEFAULT NULL COMMENT '任务执行数据',
`trigger_time` datetime DEFAULT NULL COMMENT '调度-时间',
`trigger_status` varchar(255) DEFAULT NULL COMMENT '调度-结果',
`trigger_msg` varchar(2048) DEFAULT NULL COMMENT '调度-日志',
Expand Down
3 changes: 1 addition & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.xxl</groupId>
<artifactId>xxl-job</artifactId>
<version>1.1.1-SNAPSHOT</version>
<version>1.2.0-SNAPSHOT</version>
<packaging>pom</packaging>
<modules>
<module>xxl-job-admin</module>
<module>xxl-job-client</module>
<module>xxl-job-client-demo</module>
<module>xxl-job-simple</module>
</modules>

<build>
Expand Down
20 changes: 10 additions & 10 deletions xxl-job-admin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
<parent>
<groupId>com.xxl</groupId>
<artifactId>xxl-job</artifactId>
<version>1.1.1-SNAPSHOT</version>
<version>1.2.0-SNAPSHOT</version>
</parent>
<artifactId>xxl-job-admin</artifactId>
<version>1.1.2-SNAPSHOT</version>
<version>1.2.1-SNAPSHOT</version>
<packaging>war</packaging>

<properties>
Expand Down Expand Up @@ -123,25 +123,25 @@
<version>5.1.29</version>
</dependency>

<!-- quartz :quartz-2.2.1/c3p0-0.9.1.1/slf4j-api-1.6.6 -->
<dependency>
<groupId>org.quartz-scheduler</groupId>
<artifactId>quartz</artifactId>
<version>2.2.2</version>
</dependency>

<!-- httpclient -->
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.3.6</version>
</dependency>

<!-- quartz :quartz-2.2.1/c3p0-0.9.1.1/slf4j-api-1.6.6 -->
<dependency>
<groupId>org.quartz-scheduler</groupId>
<artifactId>quartz</artifactId>
<version>2.2.2</version>
</dependency>

<!-- xxl-job-client -->
<dependency>
<groupId>com.xxl</groupId>
<artifactId>xxl-job-client</artifactId>
<version>1.1.2-SNAPSHOT</version>
<version>1.2.1-SNAPSHOT</version>
</dependency>

</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,15 @@
import com.xxl.job.core.model.XxlJobInfo;
import com.xxl.job.core.util.DynamicSchedulerUtil;
import com.xxl.job.dao.IXxlJobInfoDao;
import com.xxl.job.service.job.HttpJobBean;
import com.xxl.job.service.job.LocalJobBean;
import com.xxl.job.service.job.LocalJobBeanB;
import com.xxl.job.service.job.RemoteHttpJobBean;
import com.xxl.job.service.job.impl.DemoConcurrentJobBean;
import com.xxl.job.service.job.impl.DemoNomalJobBean;

/**
* index controller
* @author xuxueli 2015-12-19 16:13:16
*/
@SuppressWarnings("unchecked")
@Controller
@RequestMapping("/jobinfo")
public class JobInfoController {
Expand All @@ -40,12 +41,12 @@ public class JobInfoController {
private IXxlJobInfoDao xxlJobInfoDao;

// remote job bean
public static Class <? extends Job> remoteJobBean = HttpJobBean.class;
public static Class <? extends Job> remoteJobBean = RemoteHttpJobBean.class;
// loacal job bean
public static List<Class <? extends Job>> localJobBeanList = new ArrayList<Class<? extends Job>>();
static{
localJobBeanList.add(LocalJobBean.class);
localJobBeanList.add(LocalJobBeanB.class);
localJobBeanList.add((Class<? extends Job>) DemoNomalJobBean.class);
localJobBeanList.add((Class<? extends Job>) DemoConcurrentJobBean.class);
}

@RequestMapping
Expand Down Expand Up @@ -81,12 +82,11 @@ public Map<String, Object> pageList(@RequestParam(required = false, defaultValue
return maps;
}

@SuppressWarnings("unchecked")
@RequestMapping("/add")
@ResponseBody
public ReturnT<String> add(String jobGroup, String jobName, String jobCron, String jobDesc, String jobClass,
String handler_params, String handler_address, String handler_name,
String author, String alarm_email, int alarm_threshold) {
String author, String alarmEmail, int alarmThreshold) {

// valid
if (JobGroupEnum.match(jobGroup) == null) {
Expand Down Expand Up @@ -124,7 +124,7 @@ public ReturnT<String> add(String jobGroup, String jobName, String jobCron, Stri
if (StringUtils.isBlank(author)) {
return new ReturnT<String>(500, "请输入“负责人”");
}
if (StringUtils.isBlank(alarm_email)) {
if (StringUtils.isBlank(alarmEmail)) {
return new ReturnT<String>(500, "请输入“报警邮件”");
}

Expand All @@ -137,6 +137,7 @@ public ReturnT<String> add(String jobGroup, String jobName, String jobCron, Stri
return new ReturnT<String>(500, "此任务已存在,请更换任务组或任务名");
}

// parse jobDataMap
HashMap<String, String> jobDataMap = new HashMap<String, String>();
jobDataMap.put(HandlerRepository.HANDLER_PARAMS, handler_params);
jobDataMap.put(HandlerRepository.HANDLER_ADDRESS, handler_address);
Expand All @@ -151,8 +152,8 @@ public ReturnT<String> add(String jobGroup, String jobName, String jobCron, Stri
jobInfo.setJobClass(jobClass);
jobInfo.setJobData(JacksonUtil.writeValueAsString(jobDataMap));
jobInfo.setAuthor(author);
jobInfo.setAlarmEmail(alarm_email);
jobInfo.setAlarmThreshold(alarm_threshold);
jobInfo.setAlarmEmail(alarmEmail);
jobInfo.setAlarmThreshold(alarmThreshold);
xxlJobInfoDao.save(jobInfo);

try {
Expand All @@ -174,7 +175,7 @@ public ReturnT<String> add(String jobGroup, String jobName, String jobCron, Stri
@ResponseBody
public ReturnT<String> reschedule(String jobGroup, String jobName, String jobCron, String jobDesc, String jobClass,
String handler_params, String handler_address, String handler_name,
String author, String alarm_email, int alarm_threshold) {
String author, String alarmEmail, int alarmThreshold) {

// valid
if (JobGroupEnum.match(jobGroup) == null) {
Expand All @@ -187,8 +188,19 @@ public ReturnT<String> reschedule(String jobGroup, String jobName, String jobCro
return new ReturnT<String>(500, "“corn”不合法");
}

// parse jobDataMap
HashMap<String, String> jobDataMap = new HashMap<String, String>();
jobDataMap.put(HandlerRepository.HANDLER_PARAMS, handler_params);
jobDataMap.put(HandlerRepository.HANDLER_ADDRESS, handler_address);
jobDataMap.put(HandlerRepository.HANDLER_NAME, handler_name);

XxlJobInfo jobInfo = xxlJobInfoDao.load(jobGroup, jobName);
jobInfo.setJobCron(jobCron);
jobInfo.setJobDesc(jobDesc);
jobInfo.setJobData(JacksonUtil.writeValueAsString(jobDataMap));
jobInfo.setAuthor(author);
jobInfo.setAlarmEmail(alarmEmail);
jobInfo.setAlarmThreshold(alarmThreshold);

try {
// fresh quartz
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,15 @@ public int save(XxlJobLog xxlJobLog) {

@Override
public int updateTriggerInfo(XxlJobLog xxlJobLog) {
if (xxlJobLog!=null && xxlJobLog.getTriggerMsg().length()>2000) {
if (xxlJobLog!=null && xxlJobLog.getTriggerMsg()!=null && xxlJobLog.getTriggerMsg().length()>2000) {
xxlJobLog.setTriggerMsg(xxlJobLog.getTriggerMsg().substring(0, 2000));
}
return sqlSessionTemplate.update("XxlJobLogMapper.updateTriggerInfo", xxlJobLog);
}

@Override
public int updateHandleInfo(XxlJobLog xxlJobLog) {
if (xxlJobLog!=null && xxlJobLog.getHandleMsg().length()>2000) {
if (xxlJobLog!=null && xxlJobLog.getHandleMsg()!=null && xxlJobLog.getHandleMsg().length()>2000) {
xxlJobLog.setHandleMsg(xxlJobLog.getHandleMsg().substring(0, 2000));
}
return sqlSessionTemplate.update("XxlJobLogMapper.updateHandleInfo", xxlJobLog);
Expand Down

This file was deleted.

This file was deleted.

Loading

0 comments on commit 88352a7

Please sign in to comment.