Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
X
XXL-JOB
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
靳帅
XXL-JOB
Commits
d6dc40b4
提交
d6dc40b4
authored
9月 15, 2018
作者:
xuxueli
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
执行器注册方式切换优化,切换自动注册时主动同步在线机器,避免执行器为空的问题;
上级
7d9f6779
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
42 行增加
和
2 行删除
+42
-2
XXL-JOB官方文档.md
doc/XXL-JOB官方文档.md
+2
-1
JobGroupController.java
...java/com/xxl/job/admin/controller/JobGroupController.java
+40
-1
没有找到文件。
doc/XXL-JOB官方文档.md
浏览文件 @
d6dc40b4
...
...
@@ -1243,7 +1243,8 @@ Tips: 历史版本(V1.3.x)目前已经Release至稳定版本, 进入维护阶段
-
27、执行器通讯线程优化,corePoolSize从256降低至32;
-
28、新增任务运行模式 "GLUE模式(PowerShell) ",支持PowerShell脚本任务;
-
29、GLUE脚本文件自动清理功能,及时清理过期脚本文件;
-
30、【迭代中】分片任务失败重试优化,仅重试当前失败的分片;
-
30、执行器注册方式切换优化,切换自动注册时主动同步在线机器,避免执行器为空的问题;
-
31、【迭代中】分片任务失败重试优化,仅重试当前失败的分片;
### TODO LIST
...
...
xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobGroupController.java
浏览文件 @
d6dc40b4
package
com
.
xxl
.
job
.
admin
.
controller
;
import
com.xxl.job.admin.core.model.XxlJobGroup
;
import
com.xxl.job.admin.core.model.XxlJobRegistry
;
import
com.xxl.job.admin.core.schedule.XxlJobDynamicScheduler
;
import
com.xxl.job.admin.core.util.I18nUtil
;
import
com.xxl.job.admin.dao.XxlJobGroupDao
;
import
com.xxl.job.admin.dao.XxlJobInfoDao
;
import
com.xxl.job.core.biz.model.ReturnT
;
import
com.xxl.job.core.enums.RegistryConfig
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.ui.Model
;
...
...
@@ -12,6 +16,9 @@ import org.springframework.web.bind.annotation.RequestMapping;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
javax.annotation.Resource
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.HashMap
;
import
java.util.List
;
/**
...
...
@@ -80,7 +87,17 @@ public class JobGroupController {
if
(
xxlJobGroup
.
getTitle
()==
null
||
StringUtils
.
isBlank
(
xxlJobGroup
.
getTitle
()))
{
return
new
ReturnT
<
String
>(
500
,
(
I18nUtil
.
getString
(
"system_please_input"
)
+
I18nUtil
.
getString
(
"jobgroup_field_title"
))
);
}
if
(
xxlJobGroup
.
getAddressType
()!=
0
)
{
if
(
xxlJobGroup
.
getAddressType
()
==
0
)
{
// 0=自动注册
List
<
String
>
registryList
=
findRegistryByAppName
(
xxlJobGroup
.
getAppName
());
String
addressListStr
=
null
;
if
(
CollectionUtils
.
isNotEmpty
(
registryList
))
{
Collections
.
sort
(
registryList
);
addressListStr
=
StringUtils
.
join
(
registryList
,
","
);
}
xxlJobGroup
.
setAddressList
(
addressListStr
);
}
else
{
// 1=手动录入
if
(
StringUtils
.
isBlank
(
xxlJobGroup
.
getAddressList
()))
{
return
new
ReturnT
<
String
>(
500
,
I18nUtil
.
getString
(
"jobgroup_field_addressType_limit"
)
);
}
...
...
@@ -96,6 +113,28 @@ public class JobGroupController {
return
(
ret
>
0
)?
ReturnT
.
SUCCESS
:
ReturnT
.
FAIL
;
}
private
List
<
String
>
findRegistryByAppName
(
String
appNameParam
){
HashMap
<
String
,
List
<
String
>>
appAddressMap
=
new
HashMap
<
String
,
List
<
String
>>();
List
<
XxlJobRegistry
>
list
=
XxlJobDynamicScheduler
.
xxlJobRegistryDao
.
findAll
(
RegistryConfig
.
DEAD_TIMEOUT
);
if
(
list
!=
null
)
{
for
(
XxlJobRegistry
item:
list
)
{
if
(
RegistryConfig
.
RegistType
.
EXECUTOR
.
name
().
equals
(
item
.
getRegistryGroup
()))
{
String
appName
=
item
.
getRegistryKey
();
List
<
String
>
registryList
=
appAddressMap
.
get
(
appName
);
if
(
registryList
==
null
)
{
registryList
=
new
ArrayList
<
String
>();
}
if
(!
registryList
.
contains
(
item
.
getRegistryValue
()))
{
registryList
.
add
(
item
.
getRegistryValue
());
}
appAddressMap
.
put
(
appName
,
registryList
);
}
}
}
return
appAddressMap
.
get
(
appNameParam
);
}
@RequestMapping
(
"/remove"
)
@ResponseBody
public
ReturnT
<
String
>
remove
(
int
id
){
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论