Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
aboota
xxl-job
提交
b607bcde
X
xxl-job
项目概览
aboota
/
xxl-job
与 Fork 源项目一致
从无法访问的项目Fork
通知
10
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
X
xxl-job
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
b607bcde
编写于
7月 14, 2017
作者:
许雪里
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
执行器路由逻辑优化
上级
2ed78c55
变更
12
隐藏空白更改
内联
并排
Showing
12 changed file
with
30 addition
and
33 deletion
+30
-33
xxl-job-admin/src/main/java/com/xxl/job/admin/core/route/ExecutorRouter.java
...ain/java/com/xxl/job/admin/core/route/ExecutorRouter.java
+2
-3
xxl-job-admin/src/main/java/com/xxl/job/admin/core/route/strategy/ExecutorRouteBusyover.java
.../job/admin/core/route/strategy/ExecutorRouteBusyover.java
+5
-4
xxl-job-admin/src/main/java/com/xxl/job/admin/core/route/strategy/ExecutorRouteConsistentHash.java
...dmin/core/route/strategy/ExecutorRouteConsistentHash.java
+2
-3
xxl-job-admin/src/main/java/com/xxl/job/admin/core/route/strategy/ExecutorRouteFailover.java
.../job/admin/core/route/strategy/ExecutorRouteFailover.java
+5
-4
xxl-job-admin/src/main/java/com/xxl/job/admin/core/route/strategy/ExecutorRouteFirst.java
...xxl/job/admin/core/route/strategy/ExecutorRouteFirst.java
+2
-2
xxl-job-admin/src/main/java/com/xxl/job/admin/core/route/strategy/ExecutorRouteLFU.java
...m/xxl/job/admin/core/route/strategy/ExecutorRouteLFU.java
+2
-3
xxl-job-admin/src/main/java/com/xxl/job/admin/core/route/strategy/ExecutorRouteLRU.java
...m/xxl/job/admin/core/route/strategy/ExecutorRouteLRU.java
+2
-3
xxl-job-admin/src/main/java/com/xxl/job/admin/core/route/strategy/ExecutorRouteLast.java
.../xxl/job/admin/core/route/strategy/ExecutorRouteLast.java
+2
-2
xxl-job-admin/src/main/java/com/xxl/job/admin/core/route/strategy/ExecutorRouteRandom.java
...xl/job/admin/core/route/strategy/ExecutorRouteRandom.java
+2
-3
xxl-job-admin/src/main/java/com/xxl/job/admin/core/route/strategy/ExecutorRouteRound.java
...xxl/job/admin/core/route/strategy/ExecutorRouteRound.java
+2
-3
xxl-job-admin/src/main/java/com/xxl/job/admin/core/trigger/XxlJobTrigger.java
...in/java/com/xxl/job/admin/core/trigger/XxlJobTrigger.java
+3
-2
xxl-job-admin/src/main/webapp/static/js/joblog.index.1.js
xxl-job-admin/src/main/webapp/static/js/joblog.index.1.js
+1
-1
未找到文件。
xxl-job-admin/src/main/java/com/xxl/job/admin/core/route/ExecutorRouter.java
浏览文件 @
b607bcde
package
com.xxl.job.admin.core.route
;
import
com.xxl.job.admin.core.model.XxlJobLog
;
import
com.xxl.job.core.biz.ExecutorBiz
;
import
com.xxl.job.core.biz.model.ReturnT
;
import
com.xxl.job.core.biz.model.TriggerParam
;
...
...
@@ -21,9 +20,9 @@ public abstract class ExecutorRouter {
*
* @param triggerParam
* @param addressList
* @return
* @return
ReturnT.content: final address
*/
public
abstract
ReturnT
<
String
>
routeRun
(
TriggerParam
triggerParam
,
ArrayList
<
String
>
addressList
,
XxlJobLog
jobLog
);
public
abstract
ReturnT
<
String
>
routeRun
(
TriggerParam
triggerParam
,
ArrayList
<
String
>
addressList
);
/**
* run executor
...
...
xxl-job-admin/src/main/java/com/xxl/job/admin/core/route/strategy/ExecutorRouteBusyover.java
浏览文件 @
b607bcde
package
com.xxl.job.admin.core.route.strategy
;
import
com.xxl.job.admin.core.model.XxlJobLog
;
import
com.xxl.job.admin.core.route.ExecutorRouter
;
import
com.xxl.job.core.biz.ExecutorBiz
;
import
com.xxl.job.core.biz.model.ReturnT
;
...
...
@@ -19,7 +18,7 @@ public class ExecutorRouteBusyover extends ExecutorRouter {
}
@Override
public
ReturnT
<
String
>
routeRun
(
TriggerParam
triggerParam
,
ArrayList
<
String
>
addressList
,
XxlJobLog
jobLog
)
{
public
ReturnT
<
String
>
routeRun
(
TriggerParam
triggerParam
,
ArrayList
<
String
>
addressList
)
{
StringBuffer
idleBeatResultSB
=
new
StringBuffer
();
for
(
String
address
:
addressList
)
{
...
...
@@ -40,12 +39,14 @@ public class ExecutorRouteBusyover extends ExecutorRouter {
// beat success
if
(
idleBeatResult
.
getCode
()
==
ReturnT
.
SUCCESS_CODE
)
{
jobLog
.
setExecutorAddress
(
address
);
ReturnT
<
String
>
runResult
=
runExecutor
(
triggerParam
,
address
);
idleBeatResultSB
.
append
(
"<br><br>"
).
append
(
runResult
.
getMsg
());
return
new
ReturnT
<
String
>(
runResult
.
getCode
(),
idleBeatResultSB
.
toString
());
// result
runResult
.
setMsg
(
idleBeatResultSB
.
toString
());
runResult
.
setContent
(
address
);
return
runResult
;
}
}
...
...
xxl-job-admin/src/main/java/com/xxl/job/admin/core/route/strategy/ExecutorRouteConsistentHash.java
浏览文件 @
b607bcde
package
com.xxl.job.admin.core.route.strategy
;
import
com.xxl.job.admin.core.model.XxlJobLog
;
import
com.xxl.job.admin.core.route.ExecutorRouter
;
import
com.xxl.job.core.biz.model.ReturnT
;
import
com.xxl.job.core.biz.model.TriggerParam
;
...
...
@@ -78,13 +77,13 @@ public class ExecutorRouteConsistentHash extends ExecutorRouter {
}
@Override
public
ReturnT
<
String
>
routeRun
(
TriggerParam
triggerParam
,
ArrayList
<
String
>
addressList
,
XxlJobLog
jobLog
)
{
public
ReturnT
<
String
>
routeRun
(
TriggerParam
triggerParam
,
ArrayList
<
String
>
addressList
)
{
// address
String
address
=
route
(
triggerParam
.
getJobId
(),
addressList
);
jobLog
.
setExecutorAddress
(
address
);
// run executor
ReturnT
<
String
>
runResult
=
runExecutor
(
triggerParam
,
address
);
runResult
.
setContent
(
address
);
return
runResult
;
}
}
xxl-job-admin/src/main/java/com/xxl/job/admin/core/route/strategy/ExecutorRouteFailover.java
浏览文件 @
b607bcde
package
com.xxl.job.admin.core.route.strategy
;
import
com.xxl.job.admin.core.model.XxlJobLog
;
import
com.xxl.job.admin.core.route.ExecutorRouter
;
import
com.xxl.job.core.biz.ExecutorBiz
;
import
com.xxl.job.core.biz.model.ReturnT
;
...
...
@@ -19,7 +18,7 @@ public class ExecutorRouteFailover extends ExecutorRouter {
}
@Override
public
ReturnT
<
String
>
routeRun
(
TriggerParam
triggerParam
,
ArrayList
<
String
>
addressList
,
XxlJobLog
jobLog
)
{
public
ReturnT
<
String
>
routeRun
(
TriggerParam
triggerParam
,
ArrayList
<
String
>
addressList
)
{
StringBuffer
beatResultSB
=
new
StringBuffer
();
for
(
String
address
:
addressList
)
{
...
...
@@ -40,12 +39,14 @@ public class ExecutorRouteFailover extends ExecutorRouter {
// beat success
if
(
beatResult
.
getCode
()
==
ReturnT
.
SUCCESS_CODE
)
{
jobLog
.
setExecutorAddress
(
address
);
ReturnT
<
String
>
runResult
=
runExecutor
(
triggerParam
,
address
);
beatResultSB
.
append
(
"<br><br>"
).
append
(
runResult
.
getMsg
());
return
new
ReturnT
<
String
>(
runResult
.
getCode
(),
beatResultSB
.
toString
());
// result
runResult
.
setMsg
(
beatResultSB
.
toString
());
runResult
.
setContent
(
address
);
return
runResult
;
}
}
return
new
ReturnT
<
String
>(
ReturnT
.
FAIL_CODE
,
beatResultSB
.
toString
());
...
...
xxl-job-admin/src/main/java/com/xxl/job/admin/core/route/strategy/ExecutorRouteFirst.java
浏览文件 @
b607bcde
...
...
@@ -17,14 +17,14 @@ public class ExecutorRouteFirst extends ExecutorRouter {
}
@Override
public
ReturnT
<
String
>
routeRun
(
TriggerParam
triggerParam
,
ArrayList
<
String
>
addressList
,
XxlJobLog
jobLog
)
{
public
ReturnT
<
String
>
routeRun
(
TriggerParam
triggerParam
,
ArrayList
<
String
>
addressList
)
{
// address
String
address
=
route
(
triggerParam
.
getJobId
(),
addressList
);
jobLog
.
setExecutorAddress
(
address
);
// run executor
ReturnT
<
String
>
runResult
=
runExecutor
(
triggerParam
,
address
);
runResult
.
setContent
(
address
);
return
runResult
;
}
}
xxl-job-admin/src/main/java/com/xxl/job/admin/core/route/strategy/ExecutorRouteLFU.java
浏览文件 @
b607bcde
package
com.xxl.job.admin.core.route.strategy
;
import
com.xxl.job.admin.core.model.XxlJobLog
;
import
com.xxl.job.admin.core.route.ExecutorRouter
;
import
com.xxl.job.core.biz.model.ReturnT
;
import
com.xxl.job.core.biz.model.TriggerParam
;
...
...
@@ -57,14 +56,14 @@ public class ExecutorRouteLFU extends ExecutorRouter {
}
@Override
public
ReturnT
<
String
>
routeRun
(
TriggerParam
triggerParam
,
ArrayList
<
String
>
addressList
,
XxlJobLog
jobLog
)
{
public
ReturnT
<
String
>
routeRun
(
TriggerParam
triggerParam
,
ArrayList
<
String
>
addressList
)
{
// address
String
address
=
route
(
triggerParam
.
getJobId
(),
addressList
);
jobLog
.
setExecutorAddress
(
address
);
// run executor
ReturnT
<
String
>
runResult
=
runExecutor
(
triggerParam
,
address
);
runResult
.
setContent
(
address
);
return
runResult
;
}
...
...
xxl-job-admin/src/main/java/com/xxl/job/admin/core/route/strategy/ExecutorRouteLRU.java
浏览文件 @
b607bcde
package
com.xxl.job.admin.core.route.strategy
;
import
com.xxl.job.admin.core.model.XxlJobLog
;
import
com.xxl.job.admin.core.route.ExecutorRouter
;
import
com.xxl.job.core.biz.model.ReturnT
;
import
com.xxl.job.core.biz.model.TriggerParam
;
...
...
@@ -56,14 +55,14 @@ public class ExecutorRouteLRU extends ExecutorRouter {
@Override
public
ReturnT
<
String
>
routeRun
(
TriggerParam
triggerParam
,
ArrayList
<
String
>
addressList
,
XxlJobLog
jobLog
)
{
public
ReturnT
<
String
>
routeRun
(
TriggerParam
triggerParam
,
ArrayList
<
String
>
addressList
)
{
// address
String
address
=
route
(
triggerParam
.
getJobId
(),
addressList
);
jobLog
.
setExecutorAddress
(
address
);
// run executor
ReturnT
<
String
>
runResult
=
runExecutor
(
triggerParam
,
address
);
runResult
.
setContent
(
address
);
return
runResult
;
}
...
...
xxl-job-admin/src/main/java/com/xxl/job/admin/core/route/strategy/ExecutorRouteLast.java
浏览文件 @
b607bcde
...
...
@@ -17,13 +17,13 @@ public class ExecutorRouteLast extends ExecutorRouter {
}
@Override
public
ReturnT
<
String
>
routeRun
(
TriggerParam
triggerParam
,
ArrayList
<
String
>
addressList
,
XxlJobLog
jobLog
)
{
public
ReturnT
<
String
>
routeRun
(
TriggerParam
triggerParam
,
ArrayList
<
String
>
addressList
)
{
// address
String
address
=
route
(
triggerParam
.
getJobId
(),
addressList
);
jobLog
.
setExecutorAddress
(
address
);
// run executor
ReturnT
<
String
>
runResult
=
runExecutor
(
triggerParam
,
address
);
runResult
.
setContent
(
address
);
return
runResult
;
}
}
xxl-job-admin/src/main/java/com/xxl/job/admin/core/route/strategy/ExecutorRouteRandom.java
浏览文件 @
b607bcde
package
com.xxl.job.admin.core.route.strategy
;
import
com.xxl.job.admin.core.model.XxlJobLog
;
import
com.xxl.job.admin.core.route.ExecutorRouter
;
import
com.xxl.job.core.biz.model.ReturnT
;
import
com.xxl.job.core.biz.model.TriggerParam
;
...
...
@@ -21,13 +20,13 @@ public class ExecutorRouteRandom extends ExecutorRouter {
}
@Override
public
ReturnT
<
String
>
routeRun
(
TriggerParam
triggerParam
,
ArrayList
<
String
>
addressList
,
XxlJobLog
jobLog
)
{
public
ReturnT
<
String
>
routeRun
(
TriggerParam
triggerParam
,
ArrayList
<
String
>
addressList
)
{
// address
String
address
=
route
(
triggerParam
.
getJobId
(),
addressList
);
jobLog
.
setExecutorAddress
(
address
);
// run executor
ReturnT
<
String
>
runResult
=
runExecutor
(
triggerParam
,
address
);
runResult
.
setContent
(
address
);
return
runResult
;
}
...
...
xxl-job-admin/src/main/java/com/xxl/job/admin/core/route/strategy/ExecutorRouteRound.java
浏览文件 @
b607bcde
package
com.xxl.job.admin.core.route.strategy
;
import
com.xxl.job.admin.core.model.XxlJobLog
;
import
com.xxl.job.admin.core.route.ExecutorRouter
;
import
com.xxl.job.core.biz.model.ReturnT
;
import
com.xxl.job.core.biz.model.TriggerParam
;
...
...
@@ -36,14 +35,14 @@ public class ExecutorRouteRound extends ExecutorRouter {
@Override
public
ReturnT
<
String
>
routeRun
(
TriggerParam
triggerParam
,
ArrayList
<
String
>
addressList
,
XxlJobLog
jobLog
)
{
public
ReturnT
<
String
>
routeRun
(
TriggerParam
triggerParam
,
ArrayList
<
String
>
addressList
)
{
// address
String
address
=
route
(
triggerParam
.
getJobId
(),
addressList
);
jobLog
.
setExecutorAddress
(
address
);
// run executor
ReturnT
<
String
>
runResult
=
runExecutor
(
triggerParam
,
address
);
runResult
.
setContent
(
address
);
return
runResult
;
}
}
xxl-job-admin/src/main/java/com/xxl/job/admin/core/trigger/XxlJobTrigger.java
浏览文件 @
b607bcde
...
...
@@ -86,17 +86,18 @@ public class XxlJobTrigger {
triggerParam
.
setLogDateTim
(
jobLog
.
getTriggerTime
().
getTime
());
// 4.2、trigger-run (route run / trigger remote executor)
triggerResult
=
executorRouteStrategyEnum
.
getRouter
().
routeRun
(
triggerParam
,
addressList
,
jobLog
);
triggerResult
=
executorRouteStrategyEnum
.
getRouter
().
routeRun
(
triggerParam
,
addressList
);
triggerMsgSb
.
append
(
"<br><br><span style=\"color:#00c0ef;\" > >>>>>>>>>>>触发调度<<<<<<<<<<< </span><br>"
).
append
(
triggerResult
.
getMsg
());
// 4.3、trigger (fail retry)
if
(
triggerResult
.
getCode
()!=
ReturnT
.
SUCCESS_CODE
&&
failStrategy
==
ExecutorFailStrategyEnum
.
FAIL_RETRY
)
{
triggerResult
=
executorRouteStrategyEnum
.
getRouter
().
routeRun
(
triggerParam
,
addressList
,
jobLog
);
triggerResult
=
executorRouteStrategyEnum
.
getRouter
().
routeRun
(
triggerParam
,
addressList
);
triggerMsgSb
.
append
(
"<br><br><span style=\"color:#F39C12;\" > >>>>>>>>>>>失败重试<<<<<<<<<<< </span><br>"
).
append
(
triggerResult
.
getMsg
());
}
}
// 5、save trigger-info
jobLog
.
setExecutorAddress
(
triggerResult
.
getContent
());
jobLog
.
setTriggerCode
(
triggerResult
.
getCode
());
jobLog
.
setTriggerMsg
(
triggerMsgSb
.
toString
());
XxlJobDynamicScheduler
.
xxlJobLogDao
.
updateTriggerInfo
(
jobLog
);
...
...
xxl-job-admin/src/main/webapp/static/js/joblog.index.1.js
浏览文件 @
b607bcde
...
...
@@ -110,7 +110,7 @@ $(function() {
}
var
temp
=
''
;
temp
+=
'
执行器地址:
'
+
row
.
executorAddress
;
temp
+=
'
执行器地址:
'
+
(
row
.
executorAddress
?
row
.
executorAddress
:
''
)
;
temp
+=
'
<br>运行模式:
'
+
glueTypeTitle
;
temp
+=
'
<br>任务参数:
'
+
row
.
executorParam
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录