Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
aboota
xxl-job
提交
d0c4c3f0
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,发现更多精彩内容 >>
提交
d0c4c3f0
编写于
6月 24, 2018
作者:
许雪里
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
失败策略优化
上级
399cc2b1
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
32 addition
and
20 deletion
+32
-20
xxl-job-admin/src/main/java/com/xxl/job/admin/core/enums/ExecutorFailStrategyEnum.java
...om/xxl/job/admin/core/enums/ExecutorFailStrategyEnum.java
+4
-2
xxl-job-admin/src/main/java/com/xxl/job/admin/core/trigger/XxlJobTrigger.java
...in/java/com/xxl/job/admin/core/trigger/XxlJobTrigger.java
+5
-5
xxl-job-admin/src/main/java/com/xxl/job/admin/service/impl/AdminBizImpl.java
...ain/java/com/xxl/job/admin/service/impl/AdminBizImpl.java
+17
-5
xxl-job-admin/src/main/resources/i18n/message.properties
xxl-job-admin/src/main/resources/i18n/message.properties
+3
-4
xxl-job-admin/src/main/resources/i18n/message_en.properties
xxl-job-admin/src/main/resources/i18n/message_en.properties
+3
-4
未找到文件。
xxl-job-admin/src/main/java/com/xxl/job/admin/core/enums/ExecutorFailStrategyEnum.java
浏览文件 @
d0c4c3f0
...
@@ -7,9 +7,11 @@ import com.xxl.job.admin.core.util.I18nUtil;
...
@@ -7,9 +7,11 @@ import com.xxl.job.admin.core.util.I18nUtil;
*/
*/
public
enum
ExecutorFailStrategyEnum
{
public
enum
ExecutorFailStrategyEnum
{
FAIL_ALARM
(
I18nUtil
.
getString
(
"jobconf_fail_alarm
"
)),
NULL
(
I18nUtil
.
getString
(
"jobconf_fail_null
"
)),
FAIL_RETRY
(
I18nUtil
.
getString
(
"jobconf_fail_retry"
));
FAIL_TRIGGER_RETRY
(
I18nUtil
.
getString
(
"jobconf_fail_trigger_retry"
)),
FAIL_HANDLE_RETRY
(
I18nUtil
.
getString
(
"jobconf_fail_handle_retry"
));
private
final
String
title
;
private
final
String
title
;
private
ExecutorFailStrategyEnum
(
String
title
)
{
private
ExecutorFailStrategyEnum
(
String
title
)
{
...
...
xxl-job-admin/src/main/java/com/xxl/job/admin/core/trigger/XxlJobTrigger.java
浏览文件 @
d0c4c3f0
...
@@ -43,7 +43,7 @@ public class XxlJobTrigger {
...
@@ -43,7 +43,7 @@ public class XxlJobTrigger {
XxlJobGroup
group
=
XxlJobDynamicScheduler
.
xxlJobGroupDao
.
load
(
jobInfo
.
getJobGroup
());
// group info
XxlJobGroup
group
=
XxlJobDynamicScheduler
.
xxlJobGroupDao
.
load
(
jobInfo
.
getJobGroup
());
// group info
ExecutorBlockStrategyEnum
blockStrategy
=
ExecutorBlockStrategyEnum
.
match
(
jobInfo
.
getExecutorBlockStrategy
(),
ExecutorBlockStrategyEnum
.
SERIAL_EXECUTION
);
// block strategy
ExecutorBlockStrategyEnum
blockStrategy
=
ExecutorBlockStrategyEnum
.
match
(
jobInfo
.
getExecutorBlockStrategy
(),
ExecutorBlockStrategyEnum
.
SERIAL_EXECUTION
);
// block strategy
ExecutorFailStrategyEnum
failStrategy
=
ExecutorFailStrategyEnum
.
match
(
jobInfo
.
getExecutorFailStrategy
(),
ExecutorFailStrategyEnum
.
FAIL_ALARM
);
// fail strategy
ExecutorFailStrategyEnum
failStrategy
=
ExecutorFailStrategyEnum
.
match
(
jobInfo
.
getExecutorFailStrategy
(),
ExecutorFailStrategyEnum
.
NULL
);
// fail strategy
ExecutorRouteStrategyEnum
executorRouteStrategyEnum
=
ExecutorRouteStrategyEnum
.
match
(
jobInfo
.
getExecutorRouteStrategy
(),
null
);
// route strategy
ExecutorRouteStrategyEnum
executorRouteStrategyEnum
=
ExecutorRouteStrategyEnum
.
match
(
jobInfo
.
getExecutorRouteStrategy
(),
null
);
// route strategy
ArrayList
<
String
>
addressList
=
(
ArrayList
<
String
>)
group
.
getRegistryList
();
ArrayList
<
String
>
addressList
=
(
ArrayList
<
String
>)
group
.
getRegistryList
();
...
@@ -104,9 +104,9 @@ public class XxlJobTrigger {
...
@@ -104,9 +104,9 @@ public class XxlJobTrigger {
triggerMsgSb
.
append
(
"<br><br><span style=\"color:#00c0ef;\" > >>>>>>>>>>>"
+
I18nUtil
.
getString
(
"jobconf_trigger_run"
)
+
"<<<<<<<<<<< </span><br>"
).
append
(
triggerResult
.
getMsg
());
triggerMsgSb
.
append
(
"<br><br><span style=\"color:#00c0ef;\" > >>>>>>>>>>>"
+
I18nUtil
.
getString
(
"jobconf_trigger_run"
)
+
"<<<<<<<<<<< </span><br>"
).
append
(
triggerResult
.
getMsg
());
// 4.3、trigger (fail retry)
// 4.3、trigger (fail retry)
if
(
triggerResult
.
getCode
()!=
ReturnT
.
SUCCESS_CODE
&&
failStrategy
==
ExecutorFailStrategyEnum
.
FAIL_RETRY
)
{
if
(
triggerResult
.
getCode
()!=
ReturnT
.
SUCCESS_CODE
&&
failStrategy
==
ExecutorFailStrategyEnum
.
FAIL_
TRIGGER_
RETRY
)
{
triggerResult
=
runExecutor
(
triggerParam
,
address
);
// update04
triggerResult
=
runExecutor
(
triggerParam
,
address
);
// update04
triggerMsgSb
.
append
(
"<br><br><span style=\"color:#F39C12;\" > >>>>>>>>>>>"
+
I18nUtil
.
getString
(
"jobconf_
trigger_fail
_retry"
)
+
"<<<<<<<<<<< </span><br>"
).
append
(
triggerResult
.
getMsg
());
triggerMsgSb
.
append
(
"<br><br><span style=\"color:#F39C12;\" > >>>>>>>>>>>"
+
I18nUtil
.
getString
(
"jobconf_
fail_trigger
_retry"
)
+
"<<<<<<<<<<< </span><br>"
).
append
(
triggerResult
.
getMsg
());
}
}
}
}
...
@@ -174,9 +174,9 @@ public class XxlJobTrigger {
...
@@ -174,9 +174,9 @@ public class XxlJobTrigger {
triggerMsgSb
.
append
(
"<br><br><span style=\"color:#00c0ef;\" > >>>>>>>>>>>"
+
I18nUtil
.
getString
(
"jobconf_trigger_run"
)
+
"<<<<<<<<<<< </span><br>"
).
append
(
triggerResult
.
getMsg
());
triggerMsgSb
.
append
(
"<br><br><span style=\"color:#00c0ef;\" > >>>>>>>>>>>"
+
I18nUtil
.
getString
(
"jobconf_trigger_run"
)
+
"<<<<<<<<<<< </span><br>"
).
append
(
triggerResult
.
getMsg
());
// 4.3、trigger (fail retry)
// 4.3、trigger (fail retry)
if
(
triggerResult
.
getCode
()!=
ReturnT
.
SUCCESS_CODE
&&
failStrategy
==
ExecutorFailStrategyEnum
.
FAIL_RETRY
)
{
if
(
triggerResult
.
getCode
()!=
ReturnT
.
SUCCESS_CODE
&&
failStrategy
==
ExecutorFailStrategyEnum
.
FAIL_
TRIGGER_
RETRY
)
{
triggerResult
=
executorRouteStrategyEnum
.
getRouter
().
routeRun
(
triggerParam
,
addressList
);
triggerResult
=
executorRouteStrategyEnum
.
getRouter
().
routeRun
(
triggerParam
,
addressList
);
triggerMsgSb
.
append
(
"<br><br><span style=\"color:#F39C12;\" > >>>>>>>>>>>"
+
I18nUtil
.
getString
(
"jobconf_
trigger_fail
_retry"
)
+
"<<<<<<<<<<< </span><br>"
).
append
(
triggerResult
.
getMsg
());
triggerMsgSb
.
append
(
"<br><br><span style=\"color:#F39C12;\" > >>>>>>>>>>>"
+
I18nUtil
.
getString
(
"jobconf_
fail_trigger
_retry"
)
+
"<<<<<<<<<<< </span><br>"
).
append
(
triggerResult
.
getMsg
());
}
}
}
}
...
...
xxl-job-admin/src/main/java/com/xxl/job/admin/service/impl/AdminBizImpl.java
浏览文件 @
d0c4c3f0
package
com.xxl.job.admin.service.impl
;
package
com.xxl.job.admin.service.impl
;
import
com.xxl.job.admin.core.enums.ExecutorFailStrategyEnum
;
import
com.xxl.job.admin.core.model.XxlJobInfo
;
import
com.xxl.job.admin.core.model.XxlJobInfo
;
import
com.xxl.job.admin.core.model.XxlJobLog
;
import
com.xxl.job.admin.core.model.XxlJobLog
;
import
com.xxl.job.admin.core.util.I18nUtil
;
import
com.xxl.job.admin.core.util.I18nUtil
;
...
@@ -89,12 +90,23 @@ public class AdminBizImpl implements AdminBiz {
...
@@ -89,12 +90,23 @@ public class AdminBizImpl implements AdminBiz {
}
}
}
}
}
else
if
(
IJobHandler
.
FAIL_RETRY
.
getCode
()
==
handleCallbackParam
.
getExecuteResult
().
getCode
()){
}
else
{
ReturnT
<
String
>
retryTriggerResult
=
xxlJobService
.
triggerJob
(
log
.
getJobId
());
boolean
ifHandleRetry
=
false
;
callbackMsg
=
"<br><br><span style=\"color:#F39C12;\" > >>>>>>>>>>>"
+
I18nUtil
.
getString
(
"jobconf_exe_fail_retry"
)
+
"<<<<<<<<<<< </span><br>"
;
if
(
IJobHandler
.
FAIL_RETRY
.
getCode
()
==
handleCallbackParam
.
getExecuteResult
().
getCode
())
{
ifHandleRetry
=
true
;
}
else
{
XxlJobInfo
xxlJobInfo
=
xxlJobInfoDao
.
loadById
(
log
.
getJobId
());
if
(
ExecutorFailStrategyEnum
.
FAIL_HANDLE_RETRY
.
name
().
equals
(
xxlJobInfo
.
getExecutorFailStrategy
()))
{
ifHandleRetry
=
true
;
}
}
if
(
ifHandleRetry
){
ReturnT
<
String
>
retryTriggerResult
=
xxlJobService
.
triggerJob
(
log
.
getJobId
());
callbackMsg
=
"<br><br><span style=\"color:#F39C12;\" > >>>>>>>>>>>"
+
I18nUtil
.
getString
(
"jobconf_fail_handle_retry"
)
+
"<<<<<<<<<<< </span><br>"
;
callbackMsg
+=
MessageFormat
.
format
(
I18nUtil
.
getString
(
"jobconf_callback_msg1"
),
callbackMsg
+=
MessageFormat
.
format
(
I18nUtil
.
getString
(
"jobconf_callback_msg1"
),
(
retryTriggerResult
.
getCode
()==
ReturnT
.
SUCCESS_CODE
?
I18nUtil
.
getString
(
"system_success"
):
I18nUtil
.
getString
(
"system_fail"
)),
retryTriggerResult
.
getMsg
());
(
retryTriggerResult
.
getCode
()==
ReturnT
.
SUCCESS_CODE
?
I18nUtil
.
getString
(
"system_success"
):
I18nUtil
.
getString
(
"system_fail"
)),
retryTriggerResult
.
getMsg
());
}
}
}
// handle msg
// handle msg
...
...
xxl-job-admin/src/main/resources/i18n/message.properties
浏览文件 @
d0c4c3f0
...
@@ -198,8 +198,9 @@ jobgroup_del_limit_1=拒绝删除, 系统至少保留一个执行器
...
@@ -198,8 +198,9 @@ jobgroup_del_limit_1=拒绝删除, 系统至少保留一个执行器
jobconf_block_SERIAL_EXECUTION
=
单机串行
jobconf_block_SERIAL_EXECUTION
=
单机串行
jobconf_block_DISCARD_LATER
=
丢弃后续调度
jobconf_block_DISCARD_LATER
=
丢弃后续调度
jobconf_block_COVER_EARLY
=
覆盖之前调度
jobconf_block_COVER_EARLY
=
覆盖之前调度
jobconf_fail_alarm
=
失败告警
jobconf_fail_null
=
无
jobconf_fail_retry
=
失败重试
jobconf_fail_trigger_retry
=
调度失败重试
jobconf_fail_handle_retry
=
执行失败重试
jobconf_route_first
=
第一个
jobconf_route_first
=
第一个
jobconf_route_last
=
最后一个
jobconf_route_last
=
最后一个
jobconf_route_round
=
轮询
jobconf_route_round
=
轮询
...
@@ -223,8 +224,6 @@ jobconf_trigger_exe_regaddress=执行器-地址列表
...
@@ -223,8 +224,6 @@ jobconf_trigger_exe_regaddress=执行器-地址列表
jobconf_trigger_address_empty
=
调度失败:执行器地址为空
jobconf_trigger_address_empty
=
调度失败:执行器地址为空
jobconf_trigger_run
=
触发调度
jobconf_trigger_run
=
触发调度
jobconf_trigger_child_run
=
触发子任务
jobconf_trigger_child_run
=
触发子任务
jobconf_trigger_fail_retry
=
调度失败重试
jobconf_exe_fail_retry
=
执行失败重试
jobconf_callback_child_msg1
=
{0}/{1} [任务ID={2}], 触发{3}, 触发备注: {4} <br>
jobconf_callback_child_msg1
=
{0}/{1} [任务ID={2}], 触发{3}, 触发备注: {4} <br>
jobconf_callback_child_msg2
=
{0}/{1} [任务ID={2}], 触发失败, 触发备注: 任务ID格式错误 <br>
jobconf_callback_child_msg2
=
{0}/{1} [任务ID={2}], 触发失败, 触发备注: 任务ID格式错误 <br>
jobconf_callback_msg1
=
触发{0}, 触发备注: {1} <br>
jobconf_callback_msg1
=
触发{0}, 触发备注: {1} <br>
...
...
xxl-job-admin/src/main/resources/i18n/message_en.properties
浏览文件 @
d0c4c3f0
...
@@ -198,8 +198,9 @@ jobgroup_del_limit_1=Refuses to delete, the system retains at least one executor
...
@@ -198,8 +198,9 @@ jobgroup_del_limit_1=Refuses to delete, the system retains at least one executor
jobconf_block_SERIAL_EXECUTION
=
Serial execution
jobconf_block_SERIAL_EXECUTION
=
Serial execution
jobconf_block_DISCARD_LATER
=
Discard Later
jobconf_block_DISCARD_LATER
=
Discard Later
jobconf_block_COVER_EARLY
=
Cover Early
jobconf_block_COVER_EARLY
=
Cover Early
jobconf_fail_alarm
=
Fail Alarm
jobconf_fail_null
=
Fail Alarm
jobconf_fail_retry
=
Fail Retry
jobconf_fail_trigger_retry
=
Trigger Fail Retry
jobconf_fail_handle_retry
=
Handle Fail Retry
jobconf_route_first
=
First
jobconf_route_first
=
First
jobconf_route_last
=
Last
jobconf_route_last
=
Last
jobconf_route_round
=
Round
jobconf_route_round
=
Round
...
@@ -223,8 +224,6 @@ jobconf_trigger_exe_regaddress=Execotor-Registry Address
...
@@ -223,8 +224,6 @@ jobconf_trigger_exe_regaddress=Execotor-Registry Address
jobconf_trigger_address_empty
=
Trigger Fail:registry address is empty
jobconf_trigger_address_empty
=
Trigger Fail:registry address is empty
jobconf_trigger_run
=
Trigger Job
jobconf_trigger_run
=
Trigger Job
jobconf_trigger_child_run
=
Trigger child job
jobconf_trigger_child_run
=
Trigger child job
jobconf_trigger_fail_retry
=
Trigger fail retry
jobconf_exe_fail_retry
=
Handle fail retry
jobconf_callback_child_msg1
=
{0}/{1} [Job ID={2}], Trigger {3}, Trigger msg: {4} <br>
jobconf_callback_child_msg1
=
{0}/{1} [Job ID={2}], Trigger {3}, Trigger msg: {4} <br>
jobconf_callback_child_msg2
=
{0}/{1} [Job ID={2}], Trigger Fail, Trigger msg: Job ID is illegal <br>
jobconf_callback_child_msg2
=
{0}/{1} [Job ID={2}], Trigger Fail, Trigger msg: Job ID is illegal <br>
jobconf_callback_msg1
=
Trigger {0}, Trigger msg: {1} <br>
jobconf_callback_msg1
=
Trigger {0}, Trigger msg: {1} <br>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录