Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
aboota
xxl-job
提交
4eae26a3
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,发现更多精彩内容 >>
提交
4eae26a3
编写于
9月 16, 2018
作者:
许雪里
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
代码重构
上级
a1755156
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
43 addition
and
12 deletion
+43
-12
xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobInfoController.java
.../java/com/xxl/job/admin/controller/JobInfoController.java
+2
-1
xxl-job-admin/src/main/java/com/xxl/job/admin/core/jobbean/RemoteHttpJobBean.java
...ava/com/xxl/job/admin/core/jobbean/RemoteHttpJobBean.java
+2
-1
xxl-job-admin/src/main/java/com/xxl/job/admin/core/thread/JobFailMonitorHelper.java
...a/com/xxl/job/admin/core/thread/JobFailMonitorHelper.java
+2
-1
xxl-job-admin/src/main/java/com/xxl/job/admin/core/thread/JobTriggerPoolHelper.java
...a/com/xxl/job/admin/core/thread/JobTriggerPoolHelper.java
+5
-4
xxl-job-admin/src/main/java/com/xxl/job/admin/core/trigger/TriggerTypeEnum.java
.../java/com/xxl/job/admin/core/trigger/TriggerTypeEnum.java
+26
-0
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
-3
xxl-job-admin/src/main/java/com/xxl/job/admin/service/impl/AdminBizImpl.java
...ain/java/com/xxl/job/admin/service/impl/AdminBizImpl.java
+3
-2
未找到文件。
xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobInfoController.java
浏览文件 @
4eae26a3
...
...
@@ -4,6 +4,7 @@ import com.xxl.job.admin.core.model.XxlJobGroup;
import
com.xxl.job.admin.core.model.XxlJobInfo
;
import
com.xxl.job.admin.core.route.ExecutorRouteStrategyEnum
;
import
com.xxl.job.admin.core.thread.JobTriggerPoolHelper
;
import
com.xxl.job.admin.core.trigger.TriggerTypeEnum
;
import
com.xxl.job.admin.core.util.I18nUtil
;
import
com.xxl.job.admin.dao.XxlJobGroupDao
;
import
com.xxl.job.admin.service.XxlJobService
;
...
...
@@ -91,7 +92,7 @@ public class JobInfoController {
@RequestMapping
(
"/trigger"
)
@ResponseBody
public
ReturnT
<
String
>
triggerJob
(
int
id
)
{
JobTriggerPoolHelper
.
trigger
(
id
,
-
1
,
I18nUtil
.
getString
(
"jobconf_trigger_type_manual"
)
);
JobTriggerPoolHelper
.
trigger
(
id
,
-
1
,
TriggerTypeEnum
.
MANUAL
);
return
ReturnT
.
SUCCESS
;
}
...
...
xxl-job-admin/src/main/java/com/xxl/job/admin/core/jobbean/RemoteHttpJobBean.java
浏览文件 @
4eae26a3
package
com.xxl.job.admin.core.jobbean
;
import
com.xxl.job.admin.core.thread.JobTriggerPoolHelper
;
import
com.xxl.job.admin.core.trigger.TriggerTypeEnum
;
import
com.xxl.job.admin.core.util.I18nUtil
;
import
org.quartz.JobExecutionContext
;
import
org.quartz.JobExecutionException
;
...
...
@@ -28,7 +29,7 @@ public class RemoteHttpJobBean extends QuartzJobBean {
// trigger
//XxlJobTrigger.trigger(jobId);
JobTriggerPoolHelper
.
trigger
(
jobId
,
-
1
,
I18nUtil
.
getString
(
"jobconf_trigger_type_cron"
)
);
JobTriggerPoolHelper
.
trigger
(
jobId
,
-
1
,
TriggerTypeEnum
.
CRON
);
}
}
\ No newline at end of file
xxl-job-admin/src/main/java/com/xxl/job/admin/core/thread/JobFailMonitorHelper.java
浏览文件 @
4eae26a3
...
...
@@ -4,6 +4,7 @@ import com.xxl.job.admin.core.model.XxlJobGroup;
import
com.xxl.job.admin.core.model.XxlJobInfo
;
import
com.xxl.job.admin.core.model.XxlJobLog
;
import
com.xxl.job.admin.core.schedule.XxlJobDynamicScheduler
;
import
com.xxl.job.admin.core.trigger.TriggerTypeEnum
;
import
com.xxl.job.admin.core.util.I18nUtil
;
import
com.xxl.job.admin.core.util.MailUtil
;
import
com.xxl.job.core.biz.model.ReturnT
;
...
...
@@ -75,7 +76,7 @@ public class JobFailMonitorHelper {
// TODO,分片任务失败重试优化,仅重试失败分片
JobTriggerPoolHelper
.
trigger
(
log
.
getJobId
(),
(
log
.
getExecutorFailRetryCount
()-
1
),
I18nUtil
.
getString
(
"jobconf_trigger_type_retry"
)
);
JobTriggerPoolHelper
.
trigger
(
log
.
getJobId
(),
(
log
.
getExecutorFailRetryCount
()-
1
),
TriggerTypeEnum
.
RETRY
);
String
retryMsg
=
"<br><br><span style=\"color:#F39C12;\" > >>>>>>>>>>>"
+
I18nUtil
.
getString
(
"jobconf_trigger_type_retry"
)
+
"<<<<<<<<<<< </span><br>"
;
log
.
setTriggerMsg
(
log
.
getTriggerMsg
()
+
retryMsg
);
XxlJobDynamicScheduler
.
xxlJobLogDao
.
updateTriggerInfo
(
log
);
...
...
xxl-job-admin/src/main/java/com/xxl/job/admin/core/thread/JobTriggerPoolHelper.java
浏览文件 @
4eae26a3
package
com.xxl.job.admin.core.thread
;
import
com.xxl.job.admin.core.trigger.TriggerTypeEnum
;
import
com.xxl.job.admin.core.trigger.XxlJobTrigger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
...
...
@@ -28,11 +29,11 @@ public class JobTriggerPoolHelper {
new
ThreadPoolExecutor
.
CallerRunsPolicy
());
public
void
addTrigger
(
final
int
jobId
,
final
int
failRetryCount
,
final
String
t
ype
){
public
void
addTrigger
(
final
int
jobId
,
final
int
failRetryCount
,
final
TriggerTypeEnum
triggerT
ype
){
triggerPool
.
execute
(
new
Runnable
()
{
@Override
public
void
run
()
{
XxlJobTrigger
.
trigger
(
jobId
,
failRetryCount
,
type
);
XxlJobTrigger
.
trigger
(
jobId
,
failRetryCount
,
t
riggerT
ype
);
}
});
}
...
...
@@ -55,8 +56,8 @@ public class JobTriggerPoolHelper {
* <0: use param from job info config
*
*/
public
static
void
trigger
(
int
jobId
,
int
failRetryCount
,
String
t
ype
)
{
helper
.
addTrigger
(
jobId
,
failRetryCount
,
type
);
public
static
void
trigger
(
int
jobId
,
int
failRetryCount
,
TriggerTypeEnum
triggerT
ype
)
{
helper
.
addTrigger
(
jobId
,
failRetryCount
,
t
riggerT
ype
);
}
public
static
void
toStop
(){
...
...
xxl-job-admin/src/main/java/com/xxl/job/admin/core/trigger/TriggerTypeEnum.java
0 → 100644
浏览文件 @
4eae26a3
package
com.xxl.job.admin.core.trigger
;
import
com.xxl.job.admin.core.util.I18nUtil
;
/**
* trigger type enum
*
* @author xuxueli 2018-09-16 04:56:41
*/
public
enum
TriggerTypeEnum
{
MANUAL
(
I18nUtil
.
getString
(
"jobconf_trigger_type_manual"
)),
CRON
(
I18nUtil
.
getString
(
"jobconf_trigger_type_cron"
)),
RETRY
(
I18nUtil
.
getString
(
"jobconf_trigger_type_retry"
)),
PARENT
(
I18nUtil
.
getString
(
"jobconf_trigger_type_parent"
)),
API
(
I18nUtil
.
getString
(
"jobconf_trigger_type_api"
));
private
TriggerTypeEnum
(
String
title
){
this
.
title
=
title
;
}
private
String
title
;
public
String
getTitle
()
{
return
title
;
}
}
xxl-job-admin/src/main/java/com/xxl/job/admin/core/trigger/XxlJobTrigger.java
浏览文件 @
4eae26a3
...
...
@@ -35,7 +35,7 @@ public class XxlJobTrigger {
* <0: use param from job info config
*
*/
public
static
void
trigger
(
int
jobId
,
int
failRetryCount
,
String
t
ype
)
{
public
static
void
trigger
(
int
jobId
,
int
failRetryCount
,
TriggerTypeEnum
triggerT
ype
)
{
// load data
XxlJobInfo
jobInfo
=
XxlJobDynamicScheduler
.
xxlJobInfoDao
.
loadById
(
jobId
);
// job info
...
...
@@ -75,7 +75,7 @@ public class XxlJobTrigger {
ReturnT
<
String
>
triggerResult
=
new
ReturnT
<
String
>(
null
);
StringBuffer
triggerMsgSb
=
new
StringBuffer
();
triggerMsgSb
.
append
(
I18nUtil
.
getString
(
"jobconf_trigger_type"
)).
append
(
":"
).
append
(
t
ype
);
triggerMsgSb
.
append
(
I18nUtil
.
getString
(
"jobconf_trigger_type"
)).
append
(
":"
).
append
(
t
riggerType
.
getTitle
()
);
triggerMsgSb
.
append
(
"<br>"
).
append
(
I18nUtil
.
getString
(
"jobconf_trigger_admin_adress"
)).
append
(
":"
).
append
(
IpUtil
.
getIp
());
triggerMsgSb
.
append
(
"<br>"
).
append
(
I18nUtil
.
getString
(
"jobconf_trigger_exe_regtype"
)).
append
(
":"
)
.
append
(
(
group
.
getAddressType
()
==
0
)?
I18nUtil
.
getString
(
"jobgroup_field_addressType_0"
):
I18nUtil
.
getString
(
"jobgroup_field_addressType_1"
)
);
...
...
@@ -134,7 +134,7 @@ public class XxlJobTrigger {
ReturnT
<
String
>
triggerResult
=
new
ReturnT
<
String
>(
null
);
StringBuffer
triggerMsgSb
=
new
StringBuffer
();
triggerMsgSb
.
append
(
I18nUtil
.
getString
(
"jobconf_trigger_type"
)).
append
(
":"
).
append
(
t
ype
);
triggerMsgSb
.
append
(
I18nUtil
.
getString
(
"jobconf_trigger_type"
)).
append
(
":"
).
append
(
t
riggerType
.
getTitle
()
);
triggerMsgSb
.
append
(
"<br>"
).
append
(
I18nUtil
.
getString
(
"jobconf_trigger_admin_adress"
)).
append
(
":"
).
append
(
IpUtil
.
getIp
());
triggerMsgSb
.
append
(
"<br>"
).
append
(
I18nUtil
.
getString
(
"jobconf_trigger_exe_regtype"
)).
append
(
":"
)
.
append
(
(
group
.
getAddressType
()
==
0
)?
I18nUtil
.
getString
(
"jobgroup_field_addressType_0"
):
I18nUtil
.
getString
(
"jobgroup_field_addressType_1"
)
);
...
...
xxl-job-admin/src/main/java/com/xxl/job/admin/service/impl/AdminBizImpl.java
浏览文件 @
4eae26a3
...
...
@@ -3,6 +3,7 @@ package com.xxl.job.admin.service.impl;
import
com.xxl.job.admin.core.model.XxlJobInfo
;
import
com.xxl.job.admin.core.model.XxlJobLog
;
import
com.xxl.job.admin.core.thread.JobTriggerPoolHelper
;
import
com.xxl.job.admin.core.trigger.TriggerTypeEnum
;
import
com.xxl.job.admin.core.util.I18nUtil
;
import
com.xxl.job.admin.dao.XxlJobInfoDao
;
import
com.xxl.job.admin.dao.XxlJobLogDao
;
...
...
@@ -70,7 +71,7 @@ public class AdminBizImpl implements AdminBiz {
int
childJobId
=
(
StringUtils
.
isNotBlank
(
childJobIds
[
i
])
&&
StringUtils
.
isNumeric
(
childJobIds
[
i
]))?
Integer
.
valueOf
(
childJobIds
[
i
]):-
1
;
if
(
childJobId
>
0
)
{
JobTriggerPoolHelper
.
trigger
(
childJobId
,
0
,
I18nUtil
.
getString
(
"jobconf_trigger_type_parent"
)
);
JobTriggerPoolHelper
.
trigger
(
childJobId
,
0
,
TriggerTypeEnum
.
PARENT
);
ReturnT
<
String
>
triggerChildResult
=
ReturnT
.
SUCCESS
;
// add msg
...
...
@@ -129,7 +130,7 @@ public class AdminBizImpl implements AdminBiz {
@Override
public
ReturnT
<
String
>
triggerJob
(
int
jobId
)
{
JobTriggerPoolHelper
.
trigger
(
jobId
,
-
1
,
I18nUtil
.
getString
(
"jobconf_trigger_type_api"
)
);
JobTriggerPoolHelper
.
trigger
(
jobId
,
-
1
,
TriggerTypeEnum
.
API
);
return
ReturnT
.
SUCCESS
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录