Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
tool
/
xxl-job
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 4f53622b
authored
Dec 06, 2025
by
xuxueli
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
执行器删除逻辑优化,删除时一并清理注册表数据,避免小概率情况下注册数据堆积(ISSUE-3669);
1 parent
c4831bc4
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
27 additions
and
6 deletions
doc/XXL-JOB官方文档.md
xxl-job-admin/src/main/java/com/xxl/job/admin/controller/biz/JobGroupController.java
xxl-job-admin/src/main/java/com/xxl/job/admin/mapper/XxlJobRegistryMapper.java
xxl-job-admin/src/main/java/com/xxl/job/admin/scheduler/thread/JobRegistryHelper.java
xxl-job-admin/src/main/resources/mapper/XxlJobRegistryMapper.xml
xxl-job-admin/src/main/resources/templates/biz/group.list.ftl
xxl-job-admin/src/test/java/com/xxl/job/admin/mapper/XxlJobRegistryMapperTest.java
doc/XXL-JOB官方文档.md
View file @
4f53622
...
@@ -2701,7 +2701,8 @@ public void execute() {
...
@@ -2701,7 +2701,8 @@ public void execute() {
-
1、【修复】调度组件事务代码优化,修复DB超时等小概率情况下调度终止问题;
-
1、【修复】调度组件事务代码优化,修复DB超时等小概率情况下调度终止问题;
-
2、【修复】合并PR-3869,修复底层通讯超时设置无效问题;
-
2、【修复】合并PR-3869,修复底层通讯超时设置无效问题;
-
3、【新增】新增“执行器启用开关”配置项(xxl.job.executor.enabled),默认开启,关闭时不进行执行器初始化;
-
3、【新增】新增“执行器启用开关”配置项(xxl.job.executor.enabled),默认开启,关闭时不进行执行器初始化;
-
4、【TODO】任务调度触发后分批批量更新,提升调度性能;
-
4、【优化】执行器删除逻辑优化,删除时一并清理注册表数据,避免小概率情况下注册数据堆积(ISSUE-3669);
-
5、【TODO】任务调度触发后分批批量更新,提升调度性能;
### TODO LIST
### TODO LIST
...
...
xxl-job-admin/src/main/java/com/xxl/job/admin/controller/biz/JobGroupController.java
View file @
4f53622
...
@@ -183,24 +183,34 @@ public class JobGroupController {
...
@@ -183,24 +183,34 @@ public class JobGroupController {
@XxlSso
(
role
=
Consts
.
ADMIN_ROLE
)
@XxlSso
(
role
=
Consts
.
ADMIN_ROLE
)
public
Response
<
String
>
delete
(
@RequestParam
(
"ids[]"
)
List
<
Integer
>
ids
){
public
Response
<
String
>
delete
(
@RequestParam
(
"ids[]"
)
List
<
Integer
>
ids
){
//
val
id
//
parse
id
if
(
CollectionTool
.
isEmpty
(
ids
)
||
ids
.
size
()!=
1
)
{
if
(
CollectionTool
.
isEmpty
(
ids
)
||
ids
.
size
()!=
1
)
{
return
Response
.
ofFail
(
I18nUtil
.
getString
(
"system_please_choose"
)
+
I18nUtil
.
getString
(
"system_one"
)
+
I18nUtil
.
getString
(
"system_data"
));
return
Response
.
ofFail
(
I18nUtil
.
getString
(
"system_please_choose"
)
+
I18nUtil
.
getString
(
"system_one"
)
+
I18nUtil
.
getString
(
"system_data"
));
}
}
int
id
=
ids
.
get
(
0
);
int
id
=
ids
.
get
(
0
);
// valid
// valid repeat operation
XxlJobGroup
xxlJobGroup
=
xxlJobGroupMapper
.
load
(
id
);
if
(
xxlJobGroup
==
null
)
{
return
Response
.
ofSuccess
();
}
// whether exists job
int
count
=
xxlJobInfoMapper
.
pageListCount
(
0
,
10
,
id
,
-
1
,
null
,
null
,
null
);
int
count
=
xxlJobInfoMapper
.
pageListCount
(
0
,
10
,
id
,
-
1
,
null
,
null
,
null
);
if
(
count
>
0
)
{
if
(
count
>
0
)
{
return
Response
.
ofFail
(
I18nUtil
.
getString
(
"jobgroup_del_limit_0"
)
);
return
Response
.
ofFail
(
I18nUtil
.
getString
(
"jobgroup_del_limit_0"
)
);
}
}
// whether only exists one group
List
<
XxlJobGroup
>
allList
=
xxlJobGroupMapper
.
findAll
();
List
<
XxlJobGroup
>
allList
=
xxlJobGroupMapper
.
findAll
();
if
(
allList
.
size
()
==
1
)
{
if
(
allList
.
size
()
==
1
)
{
return
Response
.
ofFail
(
I18nUtil
.
getString
(
"jobgroup_del_limit_1"
)
);
return
Response
.
ofFail
(
I18nUtil
.
getString
(
"jobgroup_del_limit_1"
)
);
}
}
// remove group
int
ret
=
xxlJobGroupMapper
.
remove
(
id
);
int
ret
=
xxlJobGroupMapper
.
remove
(
id
);
// remove registry-data
xxlJobRegistryMapper
.
removeByRegistryGroupAndKey
(
RegistType
.
EXECUTOR
.
name
(),
xxlJobGroup
.
getAppname
());
return
(
ret
>
0
)?
Response
.
ofSuccess
():
Response
.
ofFail
();
return
(
ret
>
0
)?
Response
.
ofSuccess
():
Response
.
ofFail
();
}
}
...
...
xxl-job-admin/src/main/java/com/xxl/job/admin/mapper/XxlJobRegistryMapper.java
View file @
4f53622
...
@@ -40,4 +40,7 @@ public interface XxlJobRegistryMapper {
...
@@ -40,4 +40,7 @@ public interface XxlJobRegistryMapper {
@Param
(
"registryKey"
)
String
registryKey
,
@Param
(
"registryKey"
)
String
registryKey
,
@Param
(
"registryValue"
)
String
registryValue
);
@Param
(
"registryValue"
)
String
registryValue
);
public
int
removeByRegistryGroupAndKey
(
@Param
(
"registryGroup"
)
String
registryGroup
,
@Param
(
"registryKey"
)
String
registryKey
);
}
}
xxl-job-admin/src/main/java/com/xxl/job/admin/scheduler/thread/JobRegistryHelper.java
View file @
4f53622
...
@@ -66,7 +66,7 @@ public class JobRegistryHelper {
...
@@ -66,7 +66,7 @@ public class JobRegistryHelper {
// remove dead address (admin/executor)
// remove dead address (admin/executor)
List
<
Integer
>
ids
=
XxlJobAdminBootstrap
.
getInstance
().
getXxlJobRegistryMapper
().
findDead
(
Const
.
DEAD_TIMEOUT
,
new
Date
());
List
<
Integer
>
ids
=
XxlJobAdminBootstrap
.
getInstance
().
getXxlJobRegistryMapper
().
findDead
(
Const
.
DEAD_TIMEOUT
,
new
Date
());
if
(
ids
!=
null
&&
ids
.
size
()>
0
)
{
if
(
ids
!=
null
&&
!
ids
.
isEmpty
()
)
{
XxlJobAdminBootstrap
.
getInstance
().
getXxlJobRegistryMapper
().
removeDead
(
ids
);
XxlJobAdminBootstrap
.
getInstance
().
getXxlJobRegistryMapper
().
removeDead
(
ids
);
}
}
...
...
xxl-job-admin/src/main/resources/mapper/XxlJobRegistryMapper.xml
View file @
4f53622
...
@@ -68,4 +68,10 @@
...
@@ -68,4 +68,10 @@
AND registry_value = #{registryValue}
AND registry_value = #{registryValue}
</delete>
</delete>
<delete
id=
"removeByRegistryGroupAndKey"
>
DELETE FROM xxl_job_registry
WHERE registry_group = #{registryGroup}
AND registry_key = #{registryKey}
</delete>
</mapper>
</mapper>
\ No newline at end of file
\ No newline at end of file
xxl-job-admin/src/main/resources/templates/biz/group.list.ftl
View file @
4f53622
...
@@ -52,7 +52,7 @@
...
@@ -52,7 +52,7 @@
<div
class=
"box-header pull-left"
id=
"data_operation"
>
<div
class=
"box-header pull-left"
id=
"data_operation"
>
<button
class=
"btn btn-sm btn-info add"
type=
"button"
><i
class=
"fa fa-plus"
></i>
${I18n.system_opt_add}
</button>
<button
class=
"btn btn-sm btn-info add"
type=
"button"
><i
class=
"fa fa-plus"
></i>
${I18n.system_opt_add}
</button>
<button
class=
"btn btn-sm btn-warning selectOnlyOne update"
type=
"button"
><i
class=
"fa fa-edit"
></i>
${I18n.system_opt_edit}
</button>
<button
class=
"btn btn-sm btn-warning selectOnlyOne update"
type=
"button"
><i
class=
"fa fa-edit"
></i>
${I18n.system_opt_edit}
</button>
<button
class=
"btn btn-sm btn-danger select
Any
delete"
type=
"button"
><i
class=
"fa fa-remove "
></i>
${I18n.system_opt_del}
</button>
<button
class=
"btn btn-sm btn-danger select
OnlyOne
delete"
type=
"button"
><i
class=
"fa fa-remove "
></i>
${I18n.system_opt_del}
</button>
</div>
</div>
<div
class=
"box-body"
>
<div
class=
"box-body"
>
<table
id=
"data_list"
class=
"table table-bordered table-striped"
width=
"100%"
>
<table
id=
"data_list"
class=
"table table-bordered table-striped"
width=
"100%"
>
...
...
xxl-job-admin/src/test/java/com/xxl/job/admin/mapper/XxlJobRegistryMapperTest.java
View file @
4f53622
package
com
.
xxl
.
job
.
admin
.
mapper
;
package
com
.
xxl
.
job
.
admin
.
mapper
;
import
com.xxl.job.admin.model.XxlJobRegistry
;
import
com.xxl.job.admin.model.XxlJobRegistry
;
import
com.xxl.job.core.constant.RegistType
;
import
jakarta.annotation.Resource
;
import
jakarta.annotation.Resource
;
import
org.junit.jupiter.api.Test
;
import
org.junit.jupiter.api.Test
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.boot.test.context.SpringBootTest
;
...
@@ -18,7 +19,7 @@ public class XxlJobRegistryMapperTest {
...
@@ -18,7 +19,7 @@ public class XxlJobRegistryMapperTest {
@Test
@Test
public
void
test
(){
public
void
test
(){
int
ret
=
xxlJobRegistryMapper
.
registrySaveOrUpdate
(
"g1"
,
"k
1"
,
"v1"
,
new
Date
());
int
ret
=
xxlJobRegistryMapper
.
registrySaveOrUpdate
(
RegistType
.
EXECUTOR
.
name
(),
"xxl-job-executor-z
1"
,
"v1"
,
new
Date
());
/*int ret = xxlJobRegistryDao.registryUpdate("g1", "k1", "v1", new Date());
/*int ret = xxlJobRegistryDao.registryUpdate("g1", "k1", "v1", new Date());
if (ret < 1) {
if (ret < 1) {
ret = xxlJobRegistryDao.registrySave("g1", "k1", "v1", new Date());
ret = xxlJobRegistryDao.registrySave("g1", "k1", "v1", new Date());
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment