v1.9.2
parent
7a0f63f74b
commit
50b1c67943
@ -1,33 +1,33 @@
|
|||||||
package com.xxl.job.admin.core.jobbean;
|
package com.xxl.job.admin.core.jobbean;
|
||||||
|
|
||||||
import com.xxl.job.admin.core.thread.JobTriggerPoolHelper;
|
import com.xxl.job.admin.core.thread.JobTriggerPoolHelper;
|
||||||
import org.quartz.JobExecutionContext;
|
import org.quartz.JobExecutionContext;
|
||||||
import org.quartz.JobExecutionException;
|
import org.quartz.JobExecutionException;
|
||||||
import org.quartz.JobKey;
|
import org.quartz.JobKey;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.scheduling.quartz.QuartzJobBean;
|
import org.springframework.scheduling.quartz.QuartzJobBean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* http job bean
|
* http job bean
|
||||||
* “@DisallowConcurrentExecution” diable concurrent, thread size can not be only one, better given more
|
* “@DisallowConcurrentExecution” diable concurrent, thread size can not be only one, better given more
|
||||||
* @author xuxueli 2015-12-17 18:20:34
|
* @author xuxueli 2015-12-17 18:20:34
|
||||||
*/
|
*/
|
||||||
//@DisallowConcurrentExecution
|
//@DisallowConcurrentExecution
|
||||||
public class RemoteHttpJobBean extends QuartzJobBean {
|
public class RemoteHttpJobBean extends QuartzJobBean {
|
||||||
private static Logger logger = LoggerFactory.getLogger(RemoteHttpJobBean.class);
|
private static Logger logger = LoggerFactory.getLogger(RemoteHttpJobBean.class);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void executeInternal(JobExecutionContext context)
|
protected void executeInternal(JobExecutionContext context)
|
||||||
throws JobExecutionException {
|
throws JobExecutionException {
|
||||||
|
|
||||||
// load jobId
|
// load jobId
|
||||||
JobKey jobKey = context.getTrigger().getJobKey();
|
JobKey jobKey = context.getTrigger().getJobKey();
|
||||||
Integer jobId = Integer.valueOf(jobKey.getName());
|
Integer jobId = Integer.valueOf(jobKey.getName());
|
||||||
|
|
||||||
// trigger
|
// trigger
|
||||||
//XxlJobTrigger.trigger(jobId);
|
//XxlJobTrigger.trigger(jobId);
|
||||||
JobTriggerPoolHelper.trigger(jobId, -1);
|
JobTriggerPoolHelper.trigger(jobId, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -1,155 +1,155 @@
|
|||||||
package com.xxl.job.admin.core.model;
|
package com.xxl.job.admin.core.model;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* xxl-job log, used to track trigger process
|
* xxl-job log, used to track trigger process
|
||||||
* @author xuxueli 2015-12-19 23:19:09
|
* @author xuxueli 2015-12-19 23:19:09
|
||||||
*/
|
*/
|
||||||
public class XxlJobLog {
|
public class XxlJobLog {
|
||||||
|
|
||||||
private int id;
|
private int id;
|
||||||
|
|
||||||
// job info
|
// job info
|
||||||
private int jobGroup;
|
private int jobGroup;
|
||||||
private int jobId;
|
private int jobId;
|
||||||
|
|
||||||
// glueType
|
// glueType
|
||||||
private String glueType;
|
private String glueType;
|
||||||
|
|
||||||
// execute info
|
// execute info
|
||||||
private String executorAddress;
|
private String executorAddress;
|
||||||
private String executorHandler;
|
private String executorHandler;
|
||||||
private String executorParam;
|
private String executorParam;
|
||||||
private int executorFailRetryCount;
|
private int executorFailRetryCount;
|
||||||
|
|
||||||
// trigger info
|
// trigger info
|
||||||
private Date triggerTime;
|
private Date triggerTime;
|
||||||
private int triggerCode;
|
private int triggerCode;
|
||||||
private String triggerMsg;
|
private String triggerMsg;
|
||||||
|
|
||||||
// handle info
|
// handle info
|
||||||
private Date handleTime;
|
private Date handleTime;
|
||||||
private int handleCode;
|
private int handleCode;
|
||||||
private String handleMsg;
|
private String handleMsg;
|
||||||
|
|
||||||
public int getId() {
|
public int getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setId(int id) {
|
public void setId(int id) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getJobGroup() {
|
public int getJobGroup() {
|
||||||
return jobGroup;
|
return jobGroup;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setJobGroup(int jobGroup) {
|
public void setJobGroup(int jobGroup) {
|
||||||
this.jobGroup = jobGroup;
|
this.jobGroup = jobGroup;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getJobId() {
|
public int getJobId() {
|
||||||
return jobId;
|
return jobId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setJobId(int jobId) {
|
public void setJobId(int jobId) {
|
||||||
this.jobId = jobId;
|
this.jobId = jobId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getGlueType() {
|
public String getGlueType() {
|
||||||
return glueType;
|
return glueType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setGlueType(String glueType) {
|
public void setGlueType(String glueType) {
|
||||||
this.glueType = glueType;
|
this.glueType = glueType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getExecutorAddress() {
|
public String getExecutorAddress() {
|
||||||
return executorAddress;
|
return executorAddress;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setExecutorAddress(String executorAddress) {
|
public void setExecutorAddress(String executorAddress) {
|
||||||
this.executorAddress = executorAddress;
|
this.executorAddress = executorAddress;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getExecutorHandler() {
|
public String getExecutorHandler() {
|
||||||
return executorHandler;
|
return executorHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setExecutorHandler(String executorHandler) {
|
public void setExecutorHandler(String executorHandler) {
|
||||||
this.executorHandler = executorHandler;
|
this.executorHandler = executorHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getExecutorParam() {
|
public String getExecutorParam() {
|
||||||
return executorParam;
|
return executorParam;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setExecutorParam(String executorParam) {
|
public void setExecutorParam(String executorParam) {
|
||||||
this.executorParam = executorParam;
|
this.executorParam = executorParam;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getExecutorFailRetryCount() {
|
public int getExecutorFailRetryCount() {
|
||||||
return executorFailRetryCount;
|
return executorFailRetryCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setExecutorFailRetryCount(int executorFailRetryCount) {
|
public void setExecutorFailRetryCount(int executorFailRetryCount) {
|
||||||
this.executorFailRetryCount = executorFailRetryCount;
|
this.executorFailRetryCount = executorFailRetryCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Date getTriggerTime() {
|
public Date getTriggerTime() {
|
||||||
return triggerTime;
|
return triggerTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTriggerTime(Date triggerTime) {
|
public void setTriggerTime(Date triggerTime) {
|
||||||
this.triggerTime = triggerTime;
|
this.triggerTime = triggerTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getTriggerCode() {
|
public int getTriggerCode() {
|
||||||
return triggerCode;
|
return triggerCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTriggerCode(int triggerCode) {
|
public void setTriggerCode(int triggerCode) {
|
||||||
this.triggerCode = triggerCode;
|
this.triggerCode = triggerCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTriggerMsg() {
|
public String getTriggerMsg() {
|
||||||
return triggerMsg;
|
return triggerMsg;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTriggerMsg(String triggerMsg) {
|
public void setTriggerMsg(String triggerMsg) {
|
||||||
// plugin
|
// plugin
|
||||||
if (triggerMsg!=null && triggerMsg.length()>2000) {
|
if (triggerMsg!=null && triggerMsg.length()>2000) {
|
||||||
triggerMsg = triggerMsg.substring(0, 2000);
|
triggerMsg = triggerMsg.substring(0, 2000);
|
||||||
}
|
}
|
||||||
this.triggerMsg = triggerMsg;
|
this.triggerMsg = triggerMsg;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Date getHandleTime() {
|
public Date getHandleTime() {
|
||||||
return handleTime;
|
return handleTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setHandleTime(Date handleTime) {
|
public void setHandleTime(Date handleTime) {
|
||||||
this.handleTime = handleTime;
|
this.handleTime = handleTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getHandleCode() {
|
public int getHandleCode() {
|
||||||
return handleCode;
|
return handleCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setHandleCode(int handleCode) {
|
public void setHandleCode(int handleCode) {
|
||||||
this.handleCode = handleCode;
|
this.handleCode = handleCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getHandleMsg() {
|
public String getHandleMsg() {
|
||||||
return handleMsg;
|
return handleMsg;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setHandleMsg(String handleMsg) {
|
public void setHandleMsg(String handleMsg) {
|
||||||
// plugin
|
// plugin
|
||||||
if (handleMsg!=null && handleMsg.length()>2000) {
|
if (handleMsg!=null && handleMsg.length()>2000) {
|
||||||
handleMsg = handleMsg.substring(0, 2000);
|
handleMsg = handleMsg.substring(0, 2000);
|
||||||
}
|
}
|
||||||
this.handleMsg = handleMsg;
|
this.handleMsg = handleMsg;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,217 +1,217 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.xxl.job.admin.dao.XxlJobLogDao">
|
<mapper namespace="com.xxl.job.admin.dao.XxlJobLogDao">
|
||||||
|
|
||||||
<resultMap id="XxlJobLog" type="com.xxl.job.admin.core.model.XxlJobLog" >
|
<resultMap id="XxlJobLog" type="com.xxl.job.admin.core.model.XxlJobLog" >
|
||||||
<result column="id" property="id" />
|
<result column="id" property="id" />
|
||||||
|
|
||||||
<result column="job_group" property="jobGroup" />
|
<result column="job_group" property="jobGroup" />
|
||||||
<result column="job_id" property="jobId" />
|
<result column="job_id" property="jobId" />
|
||||||
|
|
||||||
<result column="glue_type" property="glueType" />
|
<result column="glue_type" property="glueType" />
|
||||||
|
|
||||||
<result column="executor_address" property="executorAddress" />
|
<result column="executor_address" property="executorAddress" />
|
||||||
<result column="executor_handler" property="executorHandler" />
|
<result column="executor_handler" property="executorHandler" />
|
||||||
<result column="executor_param" property="executorParam" />
|
<result column="executor_param" property="executorParam" />
|
||||||
<result column="executor_fail_retry_count" property="executorFailRetryCount" />
|
<result column="executor_fail_retry_count" property="executorFailRetryCount" />
|
||||||
|
|
||||||
<result column="trigger_time" property="triggerTime" />
|
<result column="trigger_time" property="triggerTime" />
|
||||||
<result column="trigger_code" property="triggerCode" />
|
<result column="trigger_code" property="triggerCode" />
|
||||||
<result column="trigger_msg" property="triggerMsg" />
|
<result column="trigger_msg" property="triggerMsg" />
|
||||||
|
|
||||||
<result column="handle_time" property="handleTime" />
|
<result column="handle_time" property="handleTime" />
|
||||||
<result column="handle_code" property="handleCode" />
|
<result column="handle_code" property="handleCode" />
|
||||||
<result column="handle_msg" property="handleMsg" />
|
<result column="handle_msg" property="handleMsg" />
|
||||||
|
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="Base_Column_List">
|
<sql id="Base_Column_List">
|
||||||
t.id,
|
t.id,
|
||||||
t.job_group,
|
t.job_group,
|
||||||
t.job_id,
|
t.job_id,
|
||||||
t.glue_type,
|
t.glue_type,
|
||||||
t.executor_address,
|
t.executor_address,
|
||||||
t.executor_handler,
|
t.executor_handler,
|
||||||
t.executor_param,
|
t.executor_param,
|
||||||
t.executor_fail_retry_count,
|
t.executor_fail_retry_count,
|
||||||
t.trigger_time,
|
t.trigger_time,
|
||||||
t.trigger_code,
|
t.trigger_code,
|
||||||
t.trigger_msg,
|
t.trigger_msg,
|
||||||
t.handle_time,
|
t.handle_time,
|
||||||
t.handle_code,
|
t.handle_code,
|
||||||
t.handle_msg
|
t.handle_msg
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="pageList" resultMap="XxlJobLog">
|
<select id="pageList" resultMap="XxlJobLog">
|
||||||
SELECT <include refid="Base_Column_List" />
|
SELECT <include refid="Base_Column_List" />
|
||||||
FROM XXL_JOB_QRTZ_TRIGGER_LOG AS t
|
FROM XXL_JOB_QRTZ_TRIGGER_LOG AS t
|
||||||
<trim prefix="WHERE" prefixOverrides="AND | OR" >
|
<trim prefix="WHERE" prefixOverrides="AND | OR" >
|
||||||
<if test="jobGroup gt 0">
|
<if test="jobGroup gt 0">
|
||||||
AND t.job_group = #{jobGroup}
|
AND t.job_group = #{jobGroup}
|
||||||
</if>
|
</if>
|
||||||
<if test="jobId gt 0">
|
<if test="jobId gt 0">
|
||||||
AND t.job_id = #{jobId}
|
AND t.job_id = #{jobId}
|
||||||
</if>
|
</if>
|
||||||
<if test="triggerTimeStart != null">
|
<if test="triggerTimeStart != null">
|
||||||
AND t.trigger_time <![CDATA[ >= ]]> #{triggerTimeStart}
|
AND t.trigger_time <![CDATA[ >= ]]> #{triggerTimeStart}
|
||||||
</if>
|
</if>
|
||||||
<if test="triggerTimeEnd != null">
|
<if test="triggerTimeEnd != null">
|
||||||
AND t.trigger_time <![CDATA[ <= ]]> #{triggerTimeEnd}
|
AND t.trigger_time <![CDATA[ <= ]]> #{triggerTimeEnd}
|
||||||
</if>
|
</if>
|
||||||
<if test="logStatus == 1" >
|
<if test="logStatus == 1" >
|
||||||
AND t.handle_code = 200
|
AND t.handle_code = 200
|
||||||
</if>
|
</if>
|
||||||
<if test="logStatus == 2" >
|
<if test="logStatus == 2" >
|
||||||
AND (
|
AND (
|
||||||
t.trigger_code NOT IN (0, 200) OR
|
t.trigger_code NOT IN (0, 200) OR
|
||||||
t.handle_code NOT IN (0, 200)
|
t.handle_code NOT IN (0, 200)
|
||||||
)
|
)
|
||||||
</if>
|
</if>
|
||||||
<if test="logStatus == 3" >
|
<if test="logStatus == 3" >
|
||||||
AND t.trigger_code = 200
|
AND t.trigger_code = 200
|
||||||
AND t.handle_code = 0
|
AND t.handle_code = 0
|
||||||
</if>
|
</if>
|
||||||
</trim>
|
</trim>
|
||||||
ORDER BY id DESC
|
ORDER BY id DESC
|
||||||
LIMIT #{offset}, #{pagesize}
|
LIMIT #{offset}, #{pagesize}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="pageListCount" resultType="int">
|
<select id="pageListCount" resultType="int">
|
||||||
SELECT count(1)
|
SELECT count(1)
|
||||||
FROM XXL_JOB_QRTZ_TRIGGER_LOG AS t
|
FROM XXL_JOB_QRTZ_TRIGGER_LOG AS t
|
||||||
<trim prefix="WHERE" prefixOverrides="AND | OR" >
|
<trim prefix="WHERE" prefixOverrides="AND | OR" >
|
||||||
<if test="jobGroup gt 0">
|
<if test="jobGroup gt 0">
|
||||||
AND t.job_group = #{jobGroup}
|
AND t.job_group = #{jobGroup}
|
||||||
</if>
|
</if>
|
||||||
<if test="jobId gt 0">
|
<if test="jobId gt 0">
|
||||||
AND t.job_id = #{jobId}
|
AND t.job_id = #{jobId}
|
||||||
</if>
|
</if>
|
||||||
<if test="triggerTimeStart != null">
|
<if test="triggerTimeStart != null">
|
||||||
AND t.trigger_time <![CDATA[ >= ]]> #{triggerTimeStart}
|
AND t.trigger_time <![CDATA[ >= ]]> #{triggerTimeStart}
|
||||||
</if>
|
</if>
|
||||||
<if test="triggerTimeEnd != null">
|
<if test="triggerTimeEnd != null">
|
||||||
AND t.trigger_time <![CDATA[ <= ]]> #{triggerTimeEnd}
|
AND t.trigger_time <![CDATA[ <= ]]> #{triggerTimeEnd}
|
||||||
</if>
|
</if>
|
||||||
<if test="logStatus == 1" >
|
<if test="logStatus == 1" >
|
||||||
AND t.handle_code = 200
|
AND t.handle_code = 200
|
||||||
</if>
|
</if>
|
||||||
<if test="logStatus == 2" >
|
<if test="logStatus == 2" >
|
||||||
AND (
|
AND (
|
||||||
t.trigger_code NOT IN (0, 200) OR
|
t.trigger_code NOT IN (0, 200) OR
|
||||||
t.handle_code NOT IN (0, 200)
|
t.handle_code NOT IN (0, 200)
|
||||||
)
|
)
|
||||||
</if>
|
</if>
|
||||||
<if test="logStatus == 3" >
|
<if test="logStatus == 3" >
|
||||||
AND t.trigger_code = 200
|
AND t.trigger_code = 200
|
||||||
AND t.handle_code = 0
|
AND t.handle_code = 0
|
||||||
</if>
|
</if>
|
||||||
</trim>
|
</trim>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="load" parameterType="java.lang.Integer" resultMap="XxlJobLog">
|
<select id="load" parameterType="java.lang.Integer" resultMap="XxlJobLog">
|
||||||
SELECT <include refid="Base_Column_List" />
|
SELECT <include refid="Base_Column_List" />
|
||||||
FROM XXL_JOB_QRTZ_TRIGGER_LOG AS t
|
FROM XXL_JOB_QRTZ_TRIGGER_LOG AS t
|
||||||
WHERE t.id = #{id}
|
WHERE t.id = #{id}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
||||||
<insert id="save" parameterType="com.xxl.job.admin.core.model.XxlJobLog" useGeneratedKeys="true" keyProperty="id" >
|
<insert id="save" parameterType="com.xxl.job.admin.core.model.XxlJobLog" useGeneratedKeys="true" keyProperty="id" >
|
||||||
INSERT INTO XXL_JOB_QRTZ_TRIGGER_LOG (
|
INSERT INTO XXL_JOB_QRTZ_TRIGGER_LOG (
|
||||||
`job_group`,
|
`job_group`,
|
||||||
`job_id`,
|
`job_id`,
|
||||||
`trigger_code`,
|
`trigger_code`,
|
||||||
`handle_code`
|
`handle_code`
|
||||||
) VALUES (
|
) VALUES (
|
||||||
#{jobGroup},
|
#{jobGroup},
|
||||||
#{jobId},
|
#{jobId},
|
||||||
#{triggerCode},
|
#{triggerCode},
|
||||||
#{handleCode}
|
#{handleCode}
|
||||||
);
|
);
|
||||||
<!--<selectKey resultType="java.lang.Integer" order="AFTER" keyProperty="id">
|
<!--<selectKey resultType="java.lang.Integer" order="AFTER" keyProperty="id">
|
||||||
SELECT LAST_INSERT_ID()
|
SELECT LAST_INSERT_ID()
|
||||||
</selectKey>-->
|
</selectKey>-->
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
<update id="updateTriggerInfo" >
|
<update id="updateTriggerInfo" >
|
||||||
UPDATE XXL_JOB_QRTZ_TRIGGER_LOG
|
UPDATE XXL_JOB_QRTZ_TRIGGER_LOG
|
||||||
SET
|
SET
|
||||||
`glue_type`= #{glueType},
|
`glue_type`= #{glueType},
|
||||||
`trigger_time`= #{triggerTime},
|
`trigger_time`= #{triggerTime},
|
||||||
`trigger_code`= #{triggerCode},
|
`trigger_code`= #{triggerCode},
|
||||||
`trigger_msg`= #{triggerMsg},
|
`trigger_msg`= #{triggerMsg},
|
||||||
`executor_address`= #{executorAddress},
|
`executor_address`= #{executorAddress},
|
||||||
`executor_handler`=#{executorHandler},
|
`executor_handler`=#{executorHandler},
|
||||||
`executor_param`= #{executorParam},
|
`executor_param`= #{executorParam},
|
||||||
`executor_fail_retry_count`= #{executorFailRetryCount}
|
`executor_fail_retry_count`= #{executorFailRetryCount}
|
||||||
WHERE `id`= #{id}
|
WHERE `id`= #{id}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<update id="updateHandleInfo">
|
<update id="updateHandleInfo">
|
||||||
UPDATE XXL_JOB_QRTZ_TRIGGER_LOG
|
UPDATE XXL_JOB_QRTZ_TRIGGER_LOG
|
||||||
SET
|
SET
|
||||||
`handle_time`= #{handleTime},
|
`handle_time`= #{handleTime},
|
||||||
`handle_code`= #{handleCode},
|
`handle_code`= #{handleCode},
|
||||||
`handle_msg`= #{handleMsg}
|
`handle_msg`= #{handleMsg}
|
||||||
WHERE `id`= #{id}
|
WHERE `id`= #{id}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<delete id="delete" >
|
<delete id="delete" >
|
||||||
delete from XXL_JOB_QRTZ_TRIGGER_LOG
|
delete from XXL_JOB_QRTZ_TRIGGER_LOG
|
||||||
WHERE job_id = #{jobId}
|
WHERE job_id = #{jobId}
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
<select id="triggerCountByHandleCode" resultType="int" >
|
<select id="triggerCountByHandleCode" resultType="int" >
|
||||||
SELECT count(1)
|
SELECT count(1)
|
||||||
FROM XXL_JOB_QRTZ_TRIGGER_LOG AS t
|
FROM XXL_JOB_QRTZ_TRIGGER_LOG AS t
|
||||||
<trim prefix="WHERE" prefixOverrides="AND | OR" >
|
<trim prefix="WHERE" prefixOverrides="AND | OR" >
|
||||||
<if test="handleCode gt 0">
|
<if test="handleCode gt 0">
|
||||||
AND t.handle_code = #{handleCode}
|
AND t.handle_code = #{handleCode}
|
||||||
</if>
|
</if>
|
||||||
</trim>
|
</trim>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="triggerCountByDay" resultType="java.util.Map" >
|
<select id="triggerCountByDay" resultType="java.util.Map" >
|
||||||
SELECT
|
SELECT
|
||||||
DATE_FORMAT(trigger_time,'%Y-%m-%d') triggerDay,
|
DATE_FORMAT(trigger_time,'%Y-%m-%d') triggerDay,
|
||||||
COUNT(handle_code) triggerDayCount,
|
COUNT(handle_code) triggerDayCount,
|
||||||
SUM(CASE WHEN (trigger_code = 200 and handle_code = 0) then 1 else 0 end) as triggerDayCountRunning,
|
SUM(CASE WHEN (trigger_code = 200 and handle_code = 0) then 1 else 0 end) as triggerDayCountRunning,
|
||||||
SUM(CASE WHEN handle_code = 200 then 1 else 0 end) as triggerDayCountSuc
|
SUM(CASE WHEN handle_code = 200 then 1 else 0 end) as triggerDayCountSuc
|
||||||
FROM XXL_JOB_QRTZ_TRIGGER_LOG
|
FROM XXL_JOB_QRTZ_TRIGGER_LOG
|
||||||
WHERE trigger_time BETWEEN #{from} and #{to}
|
WHERE trigger_time BETWEEN #{from} and #{to}
|
||||||
GROUP BY triggerDay;
|
GROUP BY triggerDay;
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<delete id="clearLog" >
|
<delete id="clearLog" >
|
||||||
delete from XXL_JOB_QRTZ_TRIGGER_LOG
|
delete from XXL_JOB_QRTZ_TRIGGER_LOG
|
||||||
<trim prefix="WHERE" prefixOverrides="AND | OR" >
|
<trim prefix="WHERE" prefixOverrides="AND | OR" >
|
||||||
<if test="jobGroup gt 0">
|
<if test="jobGroup gt 0">
|
||||||
AND job_group = #{jobGroup}
|
AND job_group = #{jobGroup}
|
||||||
</if>
|
</if>
|
||||||
<if test="jobId gt 0">
|
<if test="jobId gt 0">
|
||||||
AND job_id = #{jobId}
|
AND job_id = #{jobId}
|
||||||
</if>
|
</if>
|
||||||
<if test="clearBeforeTime != null">
|
<if test="clearBeforeTime != null">
|
||||||
AND trigger_time <![CDATA[ <= ]]> #{clearBeforeTime}
|
AND trigger_time <![CDATA[ <= ]]> #{clearBeforeTime}
|
||||||
</if>
|
</if>
|
||||||
<if test="clearBeforeNum gt 0">
|
<if test="clearBeforeNum gt 0">
|
||||||
AND id NOT in(
|
AND id NOT in(
|
||||||
SELECT id FROM(
|
SELECT id FROM(
|
||||||
SELECT id FROM XXL_JOB_QRTZ_TRIGGER_LOG AS t
|
SELECT id FROM XXL_JOB_QRTZ_TRIGGER_LOG AS t
|
||||||
<trim prefix="WHERE" prefixOverrides="AND | OR" >
|
<trim prefix="WHERE" prefixOverrides="AND | OR" >
|
||||||
<if test="jobGroup gt 0">
|
<if test="jobGroup gt 0">
|
||||||
AND t.job_group = #{jobGroup}
|
AND t.job_group = #{jobGroup}
|
||||||
</if>
|
</if>
|
||||||
<if test="jobId gt 0">
|
<if test="jobId gt 0">
|
||||||
AND t.job_id = #{jobId}
|
AND t.job_id = #{jobId}
|
||||||
</if>
|
</if>
|
||||||
</trim>
|
</trim>
|
||||||
ORDER BY t.trigger_time desc
|
ORDER BY t.trigger_time desc
|
||||||
LIMIT 0, #{clearBeforeNum}
|
LIMIT 0, #{clearBeforeNum}
|
||||||
) t1
|
) t1
|
||||||
)
|
)
|
||||||
</if>
|
</if>
|
||||||
</trim>
|
</trim>
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
@ -1,47 +1,47 @@
|
|||||||
package com.xxl.job.core.handler;
|
package com.xxl.job.core.handler;
|
||||||
|
|
||||||
import com.xxl.job.core.biz.model.ReturnT;
|
import com.xxl.job.core.biz.model.ReturnT;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* job handler
|
* job handler
|
||||||
*
|
*
|
||||||
* @author xuxueli 2015-12-19 19:06:38
|
* @author xuxueli 2015-12-19 19:06:38
|
||||||
*/
|
*/
|
||||||
public abstract class IJobHandler {
|
public abstract class IJobHandler {
|
||||||
|
|
||||||
|
|
||||||
/** success */
|
/** success */
|
||||||
public static final ReturnT<String> SUCCESS = new ReturnT<String>(200, null);
|
public static final ReturnT<String> SUCCESS = new ReturnT<String>(200, null);
|
||||||
/** fail */
|
/** fail */
|
||||||
public static final ReturnT<String> FAIL = new ReturnT<String>(500, null);
|
public static final ReturnT<String> FAIL = new ReturnT<String>(500, null);
|
||||||
/** fail timeout */
|
/** fail timeout */
|
||||||
public static final ReturnT<String> FAIL_TIMEOUT = new ReturnT<String>(502, null);
|
public static final ReturnT<String> FAIL_TIMEOUT = new ReturnT<String>(502, null);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* execute handler, invoked when executor receives a scheduling request
|
* execute handler, invoked when executor receives a scheduling request
|
||||||
*
|
*
|
||||||
* @param param
|
* @param param
|
||||||
* @return
|
* @return
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public abstract ReturnT<String> execute(String param) throws Exception;
|
public abstract ReturnT<String> execute(String param) throws Exception;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* init handler, invoked when JobThread init
|
* init handler, invoked when JobThread init
|
||||||
*/
|
*/
|
||||||
public void init() {
|
public void init() {
|
||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* destroy handler, invoked when JobThread destroy
|
* destroy handler, invoked when JobThread destroy
|
||||||
*/
|
*/
|
||||||
public void destroy() {
|
public void destroy() {
|
||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in new issue