Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
X
XXL-JOB
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
靳帅
XXL-JOB
Commits
548426e9
提交
548426e9
authored
4月 26, 2017
作者:
xueli.xue
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
1、底层表结构调整,为脚本任务做准备;
2、交互调整;
上级
c8a55b90
隐藏空白字符变更
内嵌
并排
正在显示
16 个修改的文件
包含
137 行增加
和
121 行删除
+137
-121
README.md
README.md
+2
-2
tables_xxl_job.sql
db/tables_xxl_job.sql
+4
-3
JobCodeController.java
.../java/com/xxl/job/admin/controller/JobCodeController.java
+1
-0
JobInfoController.java
.../java/com/xxl/job/admin/controller/JobInfoController.java
+4
-0
RemoteHttpJobBean.java
...ava/com/xxl/job/admin/core/jobbean/RemoteHttpJobBean.java
+2
-1
XxlJobInfo.java
...rc/main/java/com/xxl/job/admin/core/model/XxlJobInfo.java
+9
-9
XxlJobLogGlue.java
...main/java/com/xxl/job/admin/core/model/XxlJobLogGlue.java
+9
-11
XxlJobServiceImpl.java
...ava/com/xxl/job/admin/service/impl/XxlJobServiceImpl.java
+11
-3
XxlJobInfoMapper.xml
...in/src/main/resources/mybatis-mapper/XxlJobInfoMapper.xml
+5
-5
XxlJobLogGlueMapper.xml
...src/main/resources/mybatis-mapper/XxlJobLogGlueMapper.xml
+4
-0
jobinfo.index.ftl
...rc/main/webapp/WEB-INF/template/jobinfo/jobinfo.index.ftl
+27
-21
jobinfo.index.1.js
xxl-job-admin/src/main/webapp/static/js/jobinfo.index.1.js
+20
-60
ExecutorBizImpl.java
.../main/java/com/xxl/job/core/biz/impl/ExecutorBizImpl.java
+2
-1
TriggerParam.java
...rc/main/java/com/xxl/job/core/biz/model/TriggerParam.java
+5
-5
GlueTypeEnum.java
...ore/src/main/java/com/xxl/job/core/glue/GlueTypeEnum.java
+29
-0
JobThread.java
...core/src/main/java/com/xxl/job/core/thread/JobThread.java
+3
-0
没有找到文件。
README.md
浏览文件 @
548426e9
...
...
@@ -786,14 +786,14 @@ Tips: 历史版本(V1.3.x)目前已经Release至稳定版本, 进入维护阶段
#### 6.14 版本 V1.7.0 特性 (Coding)
-
1、支持脚本JOB(源码或指定路径), 即shell/python/php等, 日志实时输出并支持在线监控;定制JobHandler实现;
#### TODO LIST
-
1、任务并行触发处理规则:串行调度队列(默认)、并行、忽略、覆盖;
-
2、任务权限管理;
-
3、执行器,server启动,注册逻辑调整;
-
4、调度失败重试机制;
-
5、JobHandler开启多线程时,支持记录执行日志;
-
6、执行器与数据库解耦,只需配置调度中心集群地址即可;
-
6、执行器与数据库解耦,只需配置调度中心集群地址即可(与当前通过JDBC注册自动发现方式,相冲突,待考虑);
## 七、其他
...
...
db/tables_xxl_job.sql
浏览文件 @
548426e9
...
...
@@ -157,7 +157,7 @@ CREATE TABLE `XXL_JOB_QRTZ_TRIGGER_INFO` (
`executor_route_strategy`
varchar
(
50
)
DEFAULT
NULL
COMMENT
'执行器路由策略'
,
`executor_handler`
varchar
(
255
)
DEFAULT
NULL
COMMENT
'执行器任务handler'
,
`executor_param`
varchar
(
255
)
DEFAULT
NULL
COMMENT
'执行器任务参数'
,
`glue_
switch`
int
(
11
)
DEFAULT
'0'
COMMENT
'GLUE模式开关:0-否,1-是
'
,
`glue_
type`
varchar
(
50
)
NOT
NULL
COMMENT
'GLUE类型
'
,
`glue_source`
text
COMMENT
'GLUE源代码'
,
`glue_remark`
varchar
(
128
)
DEFAULT
NULL
COMMENT
'GLUE备注'
,
`glue_updatetime`
datetime
DEFAULT
NULL
COMMENT
'GLUE更新时间'
,
...
...
@@ -184,8 +184,9 @@ CREATE TABLE `XXL_JOB_QRTZ_TRIGGER_LOG` (
CREATE
TABLE
`XXL_JOB_QRTZ_TRIGGER_LOGGLUE`
(
`id`
int
(
11
)
NOT
NULL
AUTO_INCREMENT
,
`job_id`
int
(
11
)
NOT
NULL
COMMENT
'任务,主键ID'
,
`glue_source`
text
,
`glue_remark`
varchar
(
128
)
NOT
NULL
,
`glue_type`
varchar
(
50
)
DEFAULT
NULL
COMMENT
'GLUE类型'
,
`glue_source`
text
COMMENT
'GLUE源代码'
,
`glue_remark`
varchar
(
128
)
NOT
NULL
COMMENT
'GLUE备注'
,
`add_time`
timestamp
NULL
DEFAULT
NULL
,
`update_time`
timestamp
NULL
DEFAULT
NULL
ON
UPDATE
CURRENT_TIMESTAMP
,
PRIMARY
KEY
(
`id`
)
...
...
xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobCodeController.java
浏览文件 @
548426e9
...
...
@@ -59,6 +59,7 @@ public class JobCodeController {
// log old code
XxlJobLogGlue
xxlJobLogGlue
=
new
XxlJobLogGlue
();
xxlJobLogGlue
.
setJobId
(
exists_jobInfo
.
getId
());
xxlJobLogGlue
.
setGlueType
(
exists_jobInfo
.
getGlueType
());
xxlJobLogGlue
.
setGlueSource
(
exists_jobInfo
.
getGlueSource
());
xxlJobLogGlue
.
setGlueRemark
(
exists_jobInfo
.
getGlueRemark
());
xxlJobLogGlueDao
.
save
(
xxlJobLogGlue
);
...
...
xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobInfoController.java
浏览文件 @
548426e9
...
...
@@ -6,6 +6,7 @@ import com.xxl.job.admin.core.route.ExecutorRouteStrategyEnum;
import
com.xxl.job.admin.dao.IXxlJobGroupDao
;
import
com.xxl.job.admin.service.IXxlJobService
;
import
com.xxl.job.core.biz.model.ReturnT
;
import
com.xxl.job.core.glue.GlueTypeEnum
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.ui.Model
;
import
org.springframework.web.bind.annotation.RequestMapping
;
...
...
@@ -35,6 +36,9 @@ public class JobInfoController {
// 路由策略-列表
model
.
addAttribute
(
"ExecutorRouteStrategyEnum"
,
ExecutorRouteStrategyEnum
.
values
());
// Glue类型-字典
model
.
addAttribute
(
"GlueTypeEnum"
,
GlueTypeEnum
.
values
());
// 任务组
List
<
XxlJobGroup
>
jobGroupList
=
xxlJobGroupDao
.
findAll
();
model
.
addAttribute
(
"JobGroupList"
,
jobGroupList
);
...
...
xxl-job-admin/src/main/java/com/xxl/job/admin/core/jobbean/RemoteHttpJobBean.java
浏览文件 @
548426e9
...
...
@@ -10,6 +10,7 @@ import com.xxl.job.admin.core.thread.JobRegistryHelper;
import
com.xxl.job.core.biz.ExecutorBiz
;
import
com.xxl.job.core.biz.model.ReturnT
;
import
com.xxl.job.core.biz.model.TriggerParam
;
import
com.xxl.job.core.glue.GlueTypeEnum
;
import
com.xxl.job.core.registry.RegistHelper
;
import
com.xxl.job.core.rpc.netcom.NetComClientProxy
;
import
org.apache.commons.collections.CollectionUtils
;
...
...
@@ -59,7 +60,7 @@ public class RemoteHttpJobBean extends QuartzJobBean {
triggerParam
.
setJobId
(
jobInfo
.
getId
());
triggerParam
.
setExecutorHandler
(
jobInfo
.
getExecutorHandler
());
triggerParam
.
setExecutorParams
(
jobInfo
.
getExecutorParam
());
triggerParam
.
setGlue
Switch
((
jobInfo
.
getGlueSwitch
()==
0
)?
false
:
true
);
triggerParam
.
setGlue
Type
(
jobInfo
.
getGlueType
()
);
triggerParam
.
setGlueUpdatetime
(
jobInfo
.
getGlueUpdatetime
().
getTime
());
triggerParam
.
setLogId
(
jobLog
.
getId
());
triggerParam
.
setLogDateTim
(
jobLog
.
getTriggerTime
().
getTime
());
...
...
xxl-job-admin/src/main/java/com/xxl/job/admin/core/model/XxlJobInfo.java
浏览文件 @
548426e9
...
...
@@ -24,15 +24,15 @@ public class XxlJobInfo {
private
String
executorHandler
;
// 执行器,任务Handler名称
private
String
executorParam
;
// 执行器,任务参数
private
int
glueSwitch
;
// GLUE模式开关:0-否,1-是
private
String
glueSource
;
// GLUE源代码
private
String
glueRemark
;
// GLUE备注
private
Date
glueUpdatetime
;
// GLUE更新时间
private
String
glueType
;
// GLUE类型 #com.xxl.job.core.glue.GlueTypeEnum
private
String
glueSource
;
// GLUE源代码
private
String
glueRemark
;
// GLUE备注
private
Date
glueUpdatetime
;
// GLUE更新时间
private
String
childJobKey
;
// 子任务Key
// copy from quartz
private
String
jobStatus
;
// 任务状态 【base on quartz】
private
String
jobStatus
;
// 任务状态 【base on quartz】
public
int
getId
()
{
return
id
;
...
...
@@ -122,12 +122,12 @@ public class XxlJobInfo {
this
.
executorParam
=
executorParam
;
}
public
int
getGlueSwitch
()
{
return
glue
Switch
;
public
String
getGlueType
()
{
return
glue
Type
;
}
public
void
setGlue
Switch
(
int
glueSwitch
)
{
this
.
glue
Switch
=
glueSwitch
;
public
void
setGlue
Type
(
String
glueType
)
{
this
.
glue
Type
=
glueType
;
}
public
String
getGlueSource
()
{
...
...
xxl-job-admin/src/main/java/com/xxl/job/admin/core/model/XxlJobLogGlue.java
浏览文件 @
548426e9
...
...
@@ -8,6 +8,7 @@ public class XxlJobLogGlue {
private
int
id
;
private
int
jobId
;
// 任务主键ID
private
String
glueType
;
// GLUE类型 #com.xxl.job.core.glue.GlueTypeEnum
private
String
glueSource
;
private
String
glueRemark
;
private
String
addTime
;
...
...
@@ -29,6 +30,14 @@ public class XxlJobLogGlue {
this
.
jobId
=
jobId
;
}
public
String
getGlueType
()
{
return
glueType
;
}
public
void
setGlueType
(
String
glueType
)
{
this
.
glueType
=
glueType
;
}
public
String
getGlueSource
()
{
return
glueSource
;
}
...
...
@@ -61,15 +70,4 @@ public class XxlJobLogGlue {
this
.
updateTime
=
updateTime
;
}
@Override
public
String
toString
()
{
return
"XxlJobLogGlue{"
+
"id="
+
id
+
", jobId="
+
jobId
+
", glueSource='"
+
glueSource
+
'\''
+
", glueRemark='"
+
glueRemark
+
'\''
+
", addTime='"
+
addTime
+
'\''
+
", updateTime='"
+
updateTime
+
'\''
+
'}'
;
}
}
xxl-job-admin/src/main/java/com/xxl/job/admin/service/impl/XxlJobServiceImpl.java
浏览文件 @
548426e9
...
...
@@ -8,6 +8,7 @@ import com.xxl.job.admin.core.thread.JobRegistryHelper;
import
com.xxl.job.admin.dao.*
;
import
com.xxl.job.admin.service.IXxlJobService
;
import
com.xxl.job.core.biz.model.ReturnT
;
import
com.xxl.job.core.glue.GlueTypeEnum
;
import
com.xxl.job.core.registry.RegistHelper
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang.StringUtils
;
...
...
@@ -84,7 +85,10 @@ public class XxlJobServiceImpl implements IXxlJobService {
if
(
ExecutorRouteStrategyEnum
.
match
(
jobInfo
.
getExecutorRouteStrategy
(),
null
)
==
null
)
{
return
new
ReturnT
<
String
>(
500
,
"路由策略非法"
);
}
if
(
jobInfo
.
getGlueSwitch
()==
0
&&
StringUtils
.
isBlank
(
jobInfo
.
getExecutorHandler
()))
{
if
(
GlueTypeEnum
.
match
(
jobInfo
.
getGlueType
())
==
null
)
{
return
new
ReturnT
<
String
>(
500
,
"运行模式非法非法"
);
}
if
(
GlueTypeEnum
.
BEAN
==
GlueTypeEnum
.
match
(
jobInfo
.
getGlueType
())
&&
StringUtils
.
isBlank
(
jobInfo
.
getExecutorHandler
()))
{
return
new
ReturnT
<
String
>(
500
,
"请输入“JobHandler”"
);
}
...
...
@@ -147,7 +151,11 @@ public class XxlJobServiceImpl implements IXxlJobService {
if
(
ExecutorRouteStrategyEnum
.
match
(
jobInfo
.
getExecutorRouteStrategy
(),
null
)
==
null
)
{
return
new
ReturnT
<
String
>(
500
,
"路由策略非法"
);
}
if
(
jobInfo
.
getGlueSwitch
()==
0
&&
StringUtils
.
isBlank
(
jobInfo
.
getExecutorHandler
()))
{
if
(
GlueTypeEnum
.
match
(
jobInfo
.
getGlueType
())
==
null
)
{
return
new
ReturnT
<
String
>(
500
,
"运行模式非法非法"
);
}
if
(
GlueTypeEnum
.
BEAN
==
GlueTypeEnum
.
match
(
jobInfo
.
getGlueType
())
&&
StringUtils
.
isBlank
(
jobInfo
.
getExecutorHandler
()))
{
return
new
ReturnT
<
String
>(
500
,
"请输入“JobHandler”"
);
}
...
...
@@ -180,7 +188,7 @@ public class XxlJobServiceImpl implements IXxlJobService {
exists_jobInfo
.
setExecutorRouteStrategy
(
jobInfo
.
getExecutorRouteStrategy
());
exists_jobInfo
.
setExecutorHandler
(
jobInfo
.
getExecutorHandler
());
exists_jobInfo
.
setExecutorParam
(
jobInfo
.
getExecutorParam
());
exists_jobInfo
.
setGlue
Switch
(
jobInfo
.
getGlueSwitch
());
exists_jobInfo
.
setGlue
Type
(
jobInfo
.
getGlueType
());
exists_jobInfo
.
setChildJobKey
(
jobInfo
.
getChildJobKey
());
xxlJobInfoDao
.
update
(
exists_jobInfo
);
...
...
xxl-job-admin/src/main/resources/mybatis-mapper/XxlJobInfoMapper.xml
浏览文件 @
548426e9
...
...
@@ -20,7 +20,7 @@
<result
column=
"executor_handler"
property=
"executorHandler"
/>
<result
column=
"executor_param"
property=
"executorParam"
/>
<result
column=
"glue_
switch"
property=
"glueSwitch
"
/>
<result
column=
"glue_
type"
property=
"glueType
"
/>
<result
column=
"glue_source"
property=
"glueSource"
/>
<result
column=
"glue_remark"
property=
"glueRemark"
/>
<result
column=
"glue_updatetime"
property=
"glueUpdatetime"
/>
...
...
@@ -40,7 +40,7 @@
t.executor_route_strategy,
t.executor_handler,
t.executor_param,
t.glue_
switch
,
t.glue_
type
,
t.glue_source,
t.glue_remark,
t.glue_updatetime,
...
...
@@ -87,7 +87,7 @@
executor_route_strategy,
executor_handler,
executor_param,
glue_switch
,
glue_type
,
glue_source,
glue_remark,
glue_updatetime,
...
...
@@ -103,7 +103,7 @@
#{executorRouteStrategy},
#{executorHandler},
#{executorParam},
#{glue
Switch
},
#{glue
Type
},
#{glueSource},
#{glueRemark},
NOW(),
...
...
@@ -132,7 +132,7 @@
executor_route_strategy = #{executorRouteStrategy},
executor_handler = #{executorHandler},
executor_param = #{executorParam},
glue_
switch = #{glueSwitch
},
glue_
type = #{glueType
},
glue_source = #{glueSource},
glue_remark = #{glueRemark},
glue_updatetime = #{glueUpdatetime},
...
...
xxl-job-admin/src/main/resources/mybatis-mapper/XxlJobLogGlueMapper.xml
浏览文件 @
548426e9
...
...
@@ -6,6 +6,7 @@
<resultMap
id=
"XxlJobLogGlue"
type=
"com.xxl.job.admin.core.model.XxlJobLogGlue"
>
<result
column=
"id"
property=
"id"
/>
<result
column=
"job_id"
property=
"jobId"
/>
<result
column=
"glue_type"
property=
"glueType"
/>
<result
column=
"glue_source"
property=
"glueSource"
/>
<result
column=
"glue_remark"
property=
"glueRemark"
/>
<result
column=
"add_time"
property=
"addTime"
/>
...
...
@@ -15,6 +16,7 @@
<sql
id=
"Base_Column_List"
>
t.id,
t.job_id,
t.glue_type,
t.glue_source,
t.glue_remark,
t.add_time,
...
...
@@ -24,12 +26,14 @@
<insert
id=
"save"
parameterType=
"com.xxl.job.admin.core.model.XxlJobLogGlue"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
INSERT INTO XXL_JOB_QRTZ_TRIGGER_LOGGLUE (
`job_id`,
`glue_type`,
`glue_source`,
`glue_remark`,
`add_time`,
`update_time`
) VALUES (
#{jobId},
#{glueType},
#{glueSource},
#{glueRemark},
now(),
...
...
xxl-job-admin/src/main/webapp/WEB-INF/template/jobinfo/jobinfo.index.ftl
浏览文件 @
548426e9
...
...
@@ -83,7 +83,7 @@
<th
name=
"updateTime"
>
更新时间
</th>
<th
name=
"author"
>
负责人
</th>
<th
name=
"alarmEmail"
>
报警邮件
</th>
<th
name=
"glue
Switch"
>
GLUE
模式
</th>
<th
name=
"glue
Type"
>
运行
模式
</th>
<th
name=
"jobStatus"
>
状态
</th>
<th>
操作
</th>
</tr>
...
...
@@ -136,16 +136,22 @@
<div
class=
"col-sm-4"
><input
type=
"text"
class=
"form-control"
name=
"jobCron"
placeholder=
"请输入“Cron”"
maxlength=
"20"
></div>
</div>
<div
class=
"form-group"
>
<label
for=
"firstname"
class=
"col-sm-2 control-label"
>
JobHandler
<font
color=
"red"
>
*
</font></label>
<label
for=
"firstname"
class=
"col-sm-2 control-label"
>
运行模式
<font
color=
"red"
>
*
</font></label>
<div
class=
"col-sm-4"
>
<
div
class=
"input-group"
>
<input
type=
"text"
class=
"form-control"
name=
"executorHandler"
placeholder=
"请输入“JobHandler”"
maxlength=
"100"
>
<span
class=
"input-group-addon"
><b>
GLUE
</b>
<input
type=
"checkbox"
class=
"ifGLUE"
></spa
n>
<input
type=
"hidden"
name=
"glueSwitch"
value=
"0"
>
</
div
>
<
select
class=
"form-control glueType"
name=
"glueType"
>
<
#
list
GlueTypeEnum
as
item
>
<option
value=
"${item}"
>
${item.desc}
</optio
n>
</
#
list
>
</
select
>
</div>
<label
for=
"firstname"
class=
"col-sm-2 control-label"
>
JobHandler
<font
color=
"black"
>
*
</font></label>
<div
class=
"col-sm-4"
><input
type=
"text"
class=
"form-control"
name=
"executorHandler"
placeholder=
"请输入“JobHandler”"
maxlength=
"100"
></div>
</div>
<div
class=
"form-group"
>
<label
for=
"firstname"
class=
"col-sm-2 control-label"
>
执行参数
<font
color=
"black"
>
*
</font></label>
<div
class=
"col-sm-4"
><input
type=
"text"
class=
"form-control"
name=
"executorParam"
placeholder=
"请输入“执行参数”"
maxlength=
"100"
></div>
<label
for=
"lastname"
class=
"col-sm-2 control-label"
>
子任务Key
<font
color=
"black"
>
*
</font></label>
<div
class=
"col-sm-4"
><input
type=
"text"
class=
"form-control"
name=
"childJobKey"
placeholder=
"请输入子任务的任务Key,如存在多个逗号分隔"
maxlength=
"100"
></div>
</div>
<div
class=
"form-group"
>
<label
for=
"lastname"
class=
"col-sm-2 control-label"
>
报警邮件
<font
color=
"red"
>
*
</font></label>
...
...
@@ -153,10 +159,7 @@
<label
for=
"lastname"
class=
"col-sm-2 control-label"
>
负责人
<font
color=
"red"
>
*
</font></label>
<div
class=
"col-sm-4"
><input
type=
"text"
class=
"form-control"
name=
"author"
placeholder=
"请输入“负责人”"
maxlength=
"50"
></div>
</div>
<div
class=
"form-group"
>
<label
for=
"lastname"
class=
"col-sm-2 control-label"
>
子任务Key
<font
color=
"black"
>
*
</font></label>
<div
class=
"col-sm-4"
><input
type=
"text"
class=
"form-control"
name=
"childJobKey"
placeholder=
"请输入子任务的任务Key,如存在多个逗号分隔"
maxlength=
"100"
></div>
</div>
<hr>
<div
class=
"form-group"
>
<div
class=
"col-sm-offset-3 col-sm-6"
>
...
...
@@ -227,16 +230,22 @@ public class DemoGlueJobHandler extends IJobHandler {
<div
class=
"col-sm-4"
><input
type=
"text"
class=
"form-control"
name=
"jobCron"
placeholder=
"请输入“Cron”"
maxlength=
"20"
></div>
</div>
<div
class=
"form-group"
>
<label
for=
"firstname"
class=
"col-sm-2 control-label"
>
JobHandler
<font
color=
"red"
>
*
</font></label>
<label
for=
"firstname"
class=
"col-sm-2 control-label"
>
运行模式
<font
color=
"red"
>
*
</font></label>
<div
class=
"col-sm-4"
>
<
div
class=
"input-group"
>
<input
type=
"text"
class=
"form-control"
name=
"executorHandler"
placeholder=
"请输入“JobHandler”"
maxlength=
"100"
>
<
span
class=
"input-group-addon"
><b>
GLUE
</b>
<input
type=
"checkbox"
class=
"ifGLUE"
></spa
n>
<input
type=
"hidden"
name=
"glueSwitch"
value=
"0"
>
</
div
>
<
select
class=
"form-control glueType"
name=
"glueType"
>
<
#
list
GlueTypeEnum
as
item
>
<
option
value=
"${item}"
>
${item.desc}
</optio
n>
</
#
list
>
</
select
>
</div>
<label
for=
"firstname"
class=
"col-sm-2 control-label"
>
JobHandler
<font
color=
"black"
>
*
</font></label>
<div
class=
"col-sm-4"
><input
type=
"text"
class=
"form-control"
name=
"executorHandler"
placeholder=
"请输入“JobHandler”"
maxlength=
"100"
></div>
</div>
<div
class=
"form-group"
>
<label
for=
"firstname"
class=
"col-sm-2 control-label"
>
执行参数
<font
color=
"black"
>
*
</font></label>
<div
class=
"col-sm-4"
><input
type=
"text"
class=
"form-control"
name=
"executorParam"
placeholder=
"请输入“执行参数”"
maxlength=
"100"
></div>
<label
for=
"lastname"
class=
"col-sm-2 control-label"
>
子任务Key
<font
color=
"black"
>
*
</font></label>
<div
class=
"col-sm-4"
><input
type=
"text"
class=
"form-control"
name=
"childJobKey"
placeholder=
"请输入子任务的任务Key,如存在多个逗号分隔"
maxlength=
"100"
></div>
</div>
<div
class=
"form-group"
>
<label
for=
"lastname"
class=
"col-sm-2 control-label"
>
报警邮件
<font
color=
"red"
>
*
</font></label>
...
...
@@ -244,10 +253,7 @@ public class DemoGlueJobHandler extends IJobHandler {
<label
for=
"lastname"
class=
"col-sm-2 control-label"
>
负责人
<font
color=
"red"
>
*
</font></label>
<div
class=
"col-sm-4"
><input
type=
"text"
class=
"form-control"
name=
"author"
placeholder=
"请输入“负责人”"
maxlength=
"50"
></div>
</div>
<div
class=
"form-group"
>
<label
for=
"lastname"
class=
"col-sm-2 control-label"
>
子任务Key
<font
color=
"black"
>
*
</font></label>
<div
class=
"col-sm-4"
><input
type=
"text"
class=
"form-control"
name=
"childJobKey"
placeholder=
"请输入子任务的任务Key,如存在多个逗号分隔"
maxlength=
"100"
></div>
</div>
<hr>
<div
class=
"form-group"
>
<div
class=
"col-sm-offset-3 col-sm-6"
>
...
...
xxl-job-admin/src/main/webapp/static/js/jobinfo.index.1.js
浏览文件 @
548426e9
...
...
@@ -70,7 +70,7 @@ $(function() {
},
{
"data"
:
'author'
,
"visible"
:
true
,
"width"
:
'10%'
},
{
"data"
:
'alarmEmail'
,
"visible"
:
false
},
{
"data"
:
'glue
Switch
'
,
"visible"
:
false
},
{
"data"
:
'glue
Type
'
,
"visible"
:
false
},
{
"data"
:
'jobStatus'
,
"width"
:
'10%'
,
...
...
@@ -103,7 +103,7 @@ $(function() {
// log url
var
codeBtn
=
""
;
if
(
row
.
glueSwitch
>
0
)
{
if
(
'BEAN'
!=
row
.
glueType
)
{
var
codeUrl
=
base_url
+
'/jobcode?jobId='
+
row
.
id
;
codeBtn
=
'<button class="btn btn-warning btn-xs" type="button" onclick="javascript:window.open(
\'
'
+
codeUrl
+
'
\'
)" >GLUE</button> '
}
...
...
@@ -118,7 +118,7 @@ $(function() {
' executorRouteStrategy="'
+
row
.
executorRouteStrategy
+
'" '
+
' executorHandler="'
+
row
.
executorHandler
+
'" '
+
' executorParam="'
+
row
.
executorParam
+
'" '
+
' glue
Switch="'
+
row
.
glueSwitch
+
'" '
+
' glue
Type="'
+
row
.
glueType
+
'" '
+
' childJobKey="'
+
row
.
childJobKey
+
'" '
+
'>'
+
'<button class="btn btn-primary btn-xs job_operate" type="job_trigger" type="button">执行</button> '
+
...
...
@@ -240,9 +240,6 @@ $(function() {
jobCron
:
{
required
:
true
},
executorHandler
:
{
required
:
false
},
alarmEmail
:
{
required
:
true
},
...
...
@@ -257,9 +254,6 @@ $(function() {
jobCron
:
{
required
:
"请输入“Cron”."
},
executorHandler
:
{
required
:
"请输入“jobHandler”."
},
alarmEmail
:
{
required
:
"请输入“报警邮件”."
},
...
...
@@ -306,21 +300,20 @@ $(function() {
$
(
"#addModal .form input[name='executorHandler']"
).
removeAttr
(
"readonly"
);
});
// GLUE模式开启
$
(
".ifGLUE"
).
click
(
function
(){
var
ifGLUE
=
$
(
this
).
is
(
':checked'
);
var
$executorHandler
=
$
(
this
).
parents
(
"form"
).
find
(
"input[name='executorHandler']"
);
var
$glueSwitch
=
$
(
this
).
parents
(
"form"
).
find
(
"input[name='glueSwitch']"
);
if
(
ifGLUE
)
{
$executorHandler
.
val
(
""
);
$executorHandler
.
attr
(
"readonly"
,
"readonly"
);
$glueSwitch
.
val
(
1
);
}
else
{
$executorHandler
.
removeAttr
(
"readonly"
);
$glueSwitch
.
val
(
0
);
}
});
// GLUE模式开启
$
(
".glueType"
).
change
(
function
(){
var
$executorHandler
=
$
(
this
).
parents
(
"form"
).
find
(
"input[name='executorHandler']"
);
var
glueType
=
$
(
this
).
val
();
console
.
log
(
glueType
);
if
(
'BEAN'
!=
glueType
)
{
$executorHandler
.
val
(
""
);
$executorHandler
.
attr
(
"readonly"
,
"readonly"
);
}
else
{
$executorHandler
.
removeAttr
(
"readonly"
);
}
});
// 更新
$
(
"#job_list"
).
on
(
'click'
,
'.update'
,
function
()
{
...
...
@@ -335,20 +328,10 @@ $(function() {
$
(
"#updateModal .form input[name='executorHandler']"
).
val
(
$
(
this
).
parent
(
'p'
).
attr
(
"executorHandler"
));
$
(
"#updateModal .form input[name='executorParam']"
).
val
(
$
(
this
).
parent
(
'p'
).
attr
(
"executorParam"
));
$
(
"#updateModal .form input[name='childJobKey']"
).
val
(
$
(
this
).
parent
(
'p'
).
attr
(
"childJobKey"
));
$
(
'#updateModal .form select[name=glueType] option[value='
+
$
(
this
).
parent
(
'p'
).
attr
(
"glueType"
)
+
']'
).
prop
(
'selected'
,
true
);
// glueSwitch
var
glueSwitch
=
$
(
this
).
parent
(
'p'
).
attr
(
"glueSwitch"
);
$
(
"#updateModal .form input[name='glueSwitch']"
).
val
(
glueSwitch
);
var
$ifGLUE
=
$
(
"#updateModal .form .ifGLUE"
);
var
$executorHandler
=
$
(
"#updateModal .form input[name='executorHandler']"
);
if
(
glueSwitch
==
1
)
{
$ifGLUE
.
attr
(
"checked"
,
true
);
$executorHandler
.
val
(
""
);
$executorHandler
.
attr
(
"readonly"
,
"readonly"
);
}
else
{
$ifGLUE
.
attr
(
"checked"
,
false
);
$executorHandler
.
removeAttr
(
"readonly"
);
}
$
(
"#updateModal .form select[name=glueType]"
).
change
();
// show
$
(
'#updateModal'
).
modal
({
backdrop
:
false
,
keyboard
:
false
}).
modal
(
'show'
);
...
...
@@ -366,9 +349,6 @@ $(function() {
jobCron
:
{
required
:
true
},
executorHandler
:
{
required
:
false
},
alarmEmail
:
{
required
:
true
},
...
...
@@ -383,9 +363,6 @@ $(function() {
jobCron
:
{
required
:
"请输入“Cron”."
},
executorHandler
:
{
required
:
"请输入“jobHandler”."
},
alarmEmail
:
{
required
:
"请输入“报警邮件”."
},
...
...
@@ -428,21 +405,4 @@ $(function() {
$
(
"#updateModal .form"
)[
0
].
reset
()
});
/*
// 新增-添加参数
$("#addModal .addParam").on('click', function () {
var html = '<div class="form-group newParam">'+
'<label for="lastname" class="col-sm-2 control-label">参数 <button class="btn btn-danger btn-xs removeParam" type="button">移除</button></label>'+
'<div class="col-sm-4"><input type="text" class="form-control" name="key" placeholder="请输入参数key[将会强转为String]" maxlength="200" /></div>'+
'<div class="col-sm-6"><input type="text" class="form-control" name="value" placeholder="请输入参数value[将会强转为String]" maxlength="200" /></div>'+
'</div>';
$(this).parents('.form-group').parent().append(html);
$("#addModal .removeParam").on('click', function () {
$(this).parents('.form-group').remove();
});
});
*/
});
xxl-job-core/src/main/java/com/xxl/job/core/biz/impl/ExecutorBizImpl.java
浏览文件 @
548426e9
...
...
@@ -6,6 +6,7 @@ import com.xxl.job.core.biz.model.ReturnT;
import
com.xxl.job.core.biz.model.TriggerParam
;
import
com.xxl.job.core.executor.XxlJobExecutor
;
import
com.xxl.job.core.glue.GlueFactory
;
import
com.xxl.job.core.glue.GlueTypeEnum
;
import
com.xxl.job.core.handler.IJobHandler
;
import
com.xxl.job.core.handler.impl.GlueJobHandler
;
import
com.xxl.job.core.log.XxlJobFileAppender
;
...
...
@@ -56,7 +57,7 @@ public class ExecutorBizImpl implements ExecutorBiz {
// load old thread
JobThread
jobThread
=
XxlJobExecutor
.
loadJobThread
(
triggerParam
.
getJobId
());
if
(
!
triggerParam
.
isGlueSwitch
(
))
{
if
(
GlueTypeEnum
.
BEAN
==
GlueTypeEnum
.
match
(
triggerParam
.
getGlueType
()
))
{
// bean model
// valid handler
...
...
xxl-job-core/src/main/java/com/xxl/job/core/biz/model/TriggerParam.java
浏览文件 @
548426e9
...
...
@@ -14,7 +14,7 @@ public class TriggerParam implements Serializable{
private
String
executorHandler
;
private
String
executorParams
;
private
boolean
glueSwitch
;
private
String
glueType
;
private
long
glueUpdatetime
;
private
int
logId
;
...
...
@@ -46,12 +46,12 @@ public class TriggerParam implements Serializable{
this
.
executorParams
=
executorParams
;
}
public
boolean
isGlueSwitch
()
{
return
glue
Switch
;
public
String
getGlueType
()
{
return
glue
Type
;
}
public
void
setGlue
Switch
(
boolean
glueSwitch
)
{
this
.
glue
Switch
=
glueSwitch
;
public
void
setGlue
Type
(
String
glueType
)
{
this
.
glue
Type
=
glueType
;
}
public
long
getGlueUpdatetime
()
{
...
...
xxl-job-core/src/main/java/com/xxl/job/core/glue/GlueTypeEnum.java
0 → 100644
浏览文件 @
548426e9
package
com
.
xxl
.
job
.
core
.
glue
;
/**
* Created by xuxueli on 17/4/26.
*/
public
enum
GlueTypeEnum
{
BEAN
(
"BEAN模式"
),
GLUE_GROOVY
(
"GLUE模式(Java)"
),
GLUE_SHELL
(
"GLUE模式(Shell)"
),
GLUE_PYTHON
(
"GLUE模式(Python)"
);
private
String
desc
;
private
GlueTypeEnum
(
String
desc
)
{
this
.
desc
=
desc
;
}
public
String
getDesc
()
{
return
desc
;
}
public
static
GlueTypeEnum
match
(
String
name
){
for
(
GlueTypeEnum
item:
GlueTypeEnum
.
values
())
{
if
(
item
.
name
().
equals
(
name
))
{
return
item
;
}
}
return
null
;
}
}
xxl-job-core/src/main/java/com/xxl/job/core/thread/JobThread.java
浏览文件 @
548426e9
...
...
@@ -107,6 +107,9 @@ public class JobThread extends Thread{
}
}
}
catch
(
Exception
e
)
{
if
(
toStop
)
{
logger
.
error
(
"----------- xxl-job toStop, stopReason:{}"
,
stopReason
);
}
logger
.
error
(
"----------- xxl-job JobThread Exception:"
,
e
);
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论