Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
X
XXL-JOB
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
靳帅
XXL-JOB
Commits
1b1e783f
提交
1b1e783f
authored
7月 24, 2016
作者:
xueli.xue
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
coding
上级
e1eb3e21
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
58 行增加
和
19 行删除
+58
-19
README.md
README.md
+2
-2
XxlJobLogCallbackServerHandler.java
...b/admin/core/callback/XxlJobLogCallbackServerHandler.java
+23
-15
XxlJobServiceImpl.java
...ava/com/xxl/job/admin/service/impl/XxlJobServiceImpl.java
+31
-0
jobinfo.index.ftl
...rc/main/webapp/WEB-INF/template/jobinfo/jobinfo.index.ftl
+2
-2
没有找到文件。
README.md
浏览文件 @
1b1e783f
...
...
@@ -18,7 +18,7 @@ XXL-JOB是一个轻量级分布式任务调度框架,其核心设计目标是
-
11、支持登录验证;
-
12、GLUE:提供Web IDE,支持在线开发任务逻辑代码,动态发布,实时编译生效,省略部署上线的过程。支持30个版本的历史版本回溯。
-
12、数据加密:调度中心和执行器之间的通讯进行数据加密,提升调度信息安全性;
-
14、任务依赖:支持配置子任务依赖,当父任务执行结束且执行成功后将会主动触发一次子任务的执行;
-
14、任务依赖:支持配置子任务依赖,当父任务执行结束且执行成功后将会主动触发一次子任务的执行
, 多个子任务用逗号分隔
;
#### 1.3 发展
于2015年中,我在github上创建XXL-JOB项目仓库并提交第一个commit,随之进行系统结构设计,UI选型,交互设计……
...
...
@@ -565,7 +565,7 @@ XXL-JOB会为每次调度请求生成一个单独的日志文件,通过重写L
-
3、【重要】在 “调度中心” 支持HA的基础上,扩展执行器的Failover支持,支持配置多执行期地址;
#### 6.6 版本 V1.4.0 新特性
-
1、任务依赖: 通过事件触发方式实现, 任务执行成功并回调时会主动触发一次子任务的调度;
-
1、任务依赖: 通过事件触发方式实现, 任务执行成功并回调时会主动触发一次子任务的调度
, 多个子任务用逗号分隔
;
-
2、执行器底层实现代码进行重度重构, 优化底层建表脚本;
-
3、执行器中任务线程分组逻辑优化: 之前根据执行器JobHandler进行线程分组,当多个任务复用Jobhanlder会导致相互阻塞。现改为根据调度中心任务进行任务线程分组,任务与任务执行相互隔离;
-
4、执行器调度通讯方案优化, 通过Hex + HC实现建议RPC通讯协议, 优化了通讯参数的维护和解析流程;
...
...
xxl-job-admin/src/main/java/com/xxl/job/admin/core/callback/XxlJobLogCallbackServerHandler.java
浏览文件 @
1b1e783f
...
...
@@ -47,24 +47,32 @@ public class XxlJobLogCallbackServerHandler extends AbstractHandler {
if
(!
ResponseModel
.
SUCCESS
.
equals
(
log
.
getHandleStatus
()))
{
XxlJobInfo
xxlJobInfo
=
DynamicSchedulerUtil
.
xxlJobInfoDao
.
load
(
log
.
getJobGroup
(),
log
.
getJobName
());
if
(
xxlJobInfo
!=
null
&&
StringUtils
.
isNotBlank
(
xxlJobInfo
.
getChildJobKey
()))
{
String
[]
jobKeyArr
=
xxlJobInfo
.
getChildJobKey
().
split
(
"_"
);
if
(
jobKeyArr
!=
null
&&
jobKeyArr
.
length
==
2
)
{
XxlJobInfo
childJobInfo
=
DynamicSchedulerUtil
.
xxlJobInfoDao
.
load
(
jobKeyArr
[
0
],
jobKeyArr
[
1
]);
if
(
childJobInfo
!=
null
)
{
try
{
boolean
ret
=
DynamicSchedulerUtil
.
triggerJob
(
childJobInfo
.
getJobName
(),
childJobInfo
.
getJobGroup
());
childTriggerMsg
=
"<hr>"
;
String
[]
childJobKeys
=
xxlJobInfo
.
getChildJobKey
().
split
(
","
);
for
(
int
i
=
0
;
i
<
childJobKeys
.
length
;
i
++)
{
String
[]
jobKeyArr
=
childJobKeys
[
i
].
split
(
"_"
);
if
(
jobKeyArr
!=
null
&&
jobKeyArr
.
length
==
2
)
{
XxlJobInfo
childJobInfo
=
DynamicSchedulerUtil
.
xxlJobInfoDao
.
load
(
jobKeyArr
[
0
],
jobKeyArr
[
1
]);
if
(
childJobInfo
!=
null
)
{
try
{
boolean
ret
=
DynamicSchedulerUtil
.
triggerJob
(
childJobInfo
.
getJobName
(),
childJobInfo
.
getJobGroup
());
// add msg
childTriggerMsg
+=
MessageFormat
.
format
(
"<br> 触发子任务成功, 子任务Key: {0}, status: {1}, 子任务描述: {2}"
,
xxlJobInfo
.
getChildJobKey
(),
ret
,
childJobInfo
.
getJobDesc
());
}
catch
(
SchedulerException
e
)
{
logger
.
error
(
""
,
e
);
// add msg
childTriggerMsg
+=
MessageFormat
.
format
(
"<br> {0}/{1} 触发子任务成功, 子任务Key: {2}, status: {3}, 子任务描述: {4}"
,
(
i
+
1
),
childJobKeys
.
length
,
childJobKeys
[
i
],
ret
,
childJobInfo
.
getJobDesc
());
}
catch
(
SchedulerException
e
)
{
logger
.
error
(
""
,
e
);
}
}
else
{
childTriggerMsg
+=
MessageFormat
.
format
(
"<br> {0}/{1} 触发子任务失败, 子任务xxlJobInfo不存在, 子任务Key: {2}"
,
(
i
+
1
),
childJobKeys
.
length
,
childJobKeys
[
i
]);
}
}
else
{
childTriggerMsg
=
"<br> 触发子任务失败, 子任务xxlJobInfo不存在, 子任务Key:"
+
xxlJobInfo
.
getChildJobKey
();
}
}
else
{
childTriggerMsg
=
"<br> 触发子任务失败, 子任务Key格式错误, 子任务Key:"
+
xxlJobInfo
.
getChildJobKey
();
}
childTriggerMsg
+=
MessageFormat
.
format
(
"<br> {0}/{1} 触发子任务失败, 子任务Key格式错误, 子任务Key: {2}"
,
(
i
+
1
),
childJobKeys
.
length
,
childJobKeys
[
i
]);
}
}
}
}
...
...
xxl-job-admin/src/main/java/com/xxl/job/admin/service/impl/XxlJobServiceImpl.java
浏览文件 @
1b1e783f
...
...
@@ -17,6 +17,7 @@ import org.slf4j.LoggerFactory;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
java.text.MessageFormat
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
...
...
@@ -86,6 +87,21 @@ public class XxlJobServiceImpl implements IXxlJobService {
return
new
ReturnT
<
String
>(
500
,
"请输入“JobHandler”"
);
}
// childJobKey valid
if
(
StringUtils
.
isNotBlank
(
childJobKey
))
{
String
[]
childJobKeys
=
childJobKey
.
split
(
","
);
for
(
String
childJobKeyItem:
childJobKeys
)
{
String
[]
childJobKeyArr
=
childJobKeyItem
.
split
(
"_"
);
if
(
childJobKeyArr
.
length
!=
2
)
{
return
new
ReturnT
<
String
>(
500
,
MessageFormat
.
format
(
"子任务Key({0})格式错误"
,
childJobKeyItem
));
}
XxlJobInfo
childJobInfo
=
xxlJobInfoDao
.
load
(
childJobKeyArr
[
0
],
childJobKeyArr
[
1
]);
if
(
childJobInfo
==
null
)
{
return
new
ReturnT
<
String
>(
500
,
MessageFormat
.
format
(
"子任务Key({0})无效"
,
childJobKeyItem
));
}
}
}
// generate jobName
String
jobName
=
FastDateFormat
.
getInstance
(
"yyyyMMddHHmmssSSSS"
).
format
(
new
Date
());
try
{
...
...
@@ -158,6 +174,21 @@ public class XxlJobServiceImpl implements IXxlJobService {
return
new
ReturnT
<
String
>(
500
,
"请输入“JobHandler”"
);
}
// childJobKey valid
if
(
StringUtils
.
isNotBlank
(
childJobKey
))
{
String
[]
childJobKeys
=
childJobKey
.
split
(
","
);
for
(
String
childJobKeyItem:
childJobKeys
)
{
String
[]
childJobKeyArr
=
childJobKeyItem
.
split
(
"_"
);
if
(
childJobKeyArr
.
length
!=
2
)
{
return
new
ReturnT
<
String
>(
500
,
MessageFormat
.
format
(
"子任务Key({0})格式错误"
,
childJobKeyItem
));
}
XxlJobInfo
childJobInfo
=
xxlJobInfoDao
.
load
(
childJobKeyArr
[
0
],
childJobKeyArr
[
1
]);
if
(
childJobInfo
==
null
)
{
return
new
ReturnT
<
String
>(
500
,
MessageFormat
.
format
(
"子任务Key({0})无效"
,
childJobKeyItem
));
}
}
}
// stage job info
XxlJobInfo
jobInfo
=
xxlJobInfoDao
.
load
(
jobGroup
,
jobName
);
jobInfo
.
setJobCron
(
jobCron
);
...
...
xxl-job-admin/src/main/webapp/WEB-INF/template/jobinfo/jobinfo.index.ftl
浏览文件 @
1b1e783f
...
...
@@ -151,7 +151,7 @@
</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
class=
"col-sm-4"
><input
type=
"text"
class=
"form-control"
name=
"childJobKey"
placeholder=
"请输入子任务的任务Key
,如存在多个逗号分隔
"
maxlength=
"100"
></div>
</div>
<hr>
<div
class=
"form-group"
>
...
...
@@ -232,7 +232,7 @@ public class DemoJobHandler extends IJobHandler {
</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
class=
"col-sm-4"
><input
type=
"text"
class=
"form-control"
name=
"childJobKey"
placeholder=
"请输入子任务的任务Key
,如存在多个逗号分隔
"
maxlength=
"100"
></div>
</div>
<hr>
<div
class=
"form-group"
>
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论