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 90eba382
authored
Jul 16, 2019
by
xuxueli
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
注册监控线程优化,降低死锁几率;
1 parent
ee8fb55e
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
21 additions
and
6 deletions
doc/XXL-JOB官方文档.md
doc/db/tables_xxl_job.sql
xxl-job-admin/src/main/java/com/xxl/job/admin/core/thread/JobRegistryMonitorHelper.java
xxl-job-admin/src/main/java/com/xxl/job/admin/dao/XxlJobRegistryDao.java
xxl-job-admin/src/main/resources/mybatis-mapper/XxlJobRegistryMapper.xml
xxl-job-admin/src/test/java/com/xxl/job/admin/dao/XxlJobRegistryDaoTest.java
doc/XXL-JOB官方文档.md
View file @
90eba38
...
...
@@ -1518,6 +1518,7 @@ Tips: 历史版本(V1.3.x)目前已经Release至稳定版本, 进入维护阶段
-
7、
[
ING
]
cron在线生成工具;
-
8、
[
ING
]
任务、执行器数据全量本地缓存;新增消息表广播通知;
-
9、
[
ING
]
任务触发组件优化,常规1s预加载一次,轮空时主动休眠4s;
-
10、注册监控线程优化,降低死锁几率;
### TODO LIST
...
...
doc/db/tables_xxl_job.sql
View file @
90eba38
...
...
@@ -71,8 +71,7 @@ CREATE TABLE `xxl_job_registry` (
`registry_value`
varchar
(
255
)
NOT
NULL
,
`update_time`
timestamp
NOT
NULL
DEFAULT
CURRENT_TIMESTAMP
,
PRIMARY
KEY
(
`id`
),
KEY
`i_g_k_v`
(
`registry_group`
,
`registry_key`
,
`registry_value`
),
KEY
`i_u`
(
`update_time`
)
KEY
`i_g_k_v`
(
`registry_group`
,
`registry_key`
,
`registry_value`
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8
;
CREATE
TABLE
`xxl_job_group`
(
...
...
xxl-job-admin/src/main/java/com/xxl/job/admin/core/thread/JobRegistryMonitorHelper.java
View file @
90eba38
...
...
@@ -38,7 +38,10 @@ public class JobRegistryMonitorHelper {
if
(
groupList
!=
null
&&
!
groupList
.
isEmpty
())
{
// remove dead address (admin/executor)
XxlJobAdminConfig
.
getAdminConfig
().
getXxlJobRegistryDao
().
removeDead
(
RegistryConfig
.
DEAD_TIMEOUT
);
List
<
Integer
>
ids
=
XxlJobAdminConfig
.
getAdminConfig
().
getXxlJobRegistryDao
().
findDead
(
RegistryConfig
.
DEAD_TIMEOUT
);
if
(
ids
!=
null
&&
ids
.
size
()>
0
)
{
XxlJobAdminConfig
.
getAdminConfig
().
getXxlJobRegistryDao
().
removeDead
(
ids
);
}
// fresh online address (admin/executor)
HashMap
<
String
,
List
<
String
>>
appAddressMap
=
new
HashMap
<
String
,
List
<
String
>>();
...
...
xxl-job-admin/src/main/java/com/xxl/job/admin/dao/XxlJobRegistryDao.java
View file @
90eba38
...
...
@@ -12,7 +12,9 @@ import java.util.List;
@Mapper
public
interface
XxlJobRegistryDao
{
public
int
removeDead
(
@Param
(
"timeout"
)
int
timeout
);
public
List
<
Integer
>
findDead
(
@Param
(
"timeout"
)
int
timeout
);
public
int
removeDead
(
@Param
(
"ids"
)
List
<
Integer
>
ids
);
public
List
<
XxlJobRegistry
>
findAll
(
@Param
(
"timeout"
)
int
timeout
);
...
...
xxl-job-admin/src/main/resources/mybatis-mapper/XxlJobRegistryMapper.xml
View file @
90eba38
...
...
@@ -18,10 +18,19 @@
t.registry_value,
t.update_time
</sql>
<select
id=
"findDead"
parameterType=
"java.lang.Integer"
resultType=
"java.lang.Integer"
>
SELECT t.id
FROM xxl_job_registry AS t
WHERE t.update_time
<![CDATA[ < ]]>
DATE_ADD(NOW(),INTERVAL -#{timeout} SECOND)
</select>
<delete
id=
"removeDead"
parameterType=
"java.lang.Integer"
>
DELETE FROM xxl_job_registry
WHERE update_time
<![CDATA[ < ]]>
DATE_ADD(NOW(),INTERVAL -#{timeout} SECOND)
WHERE id in
<foreach
collection=
"ids"
item=
"item"
open=
"("
close=
")"
separator=
","
>
#{item}
</foreach>
</delete>
<select
id=
"findAll"
parameterType=
"java.lang.Integer"
resultMap=
"XxlJobRegistry"
>
...
...
xxl-job-admin/src/test/java/com/xxl/job/admin/dao/XxlJobRegistryDaoTest.java
View file @
90eba38
...
...
@@ -7,6 +7,7 @@ import org.springframework.boot.test.context.SpringBootTest;
import
org.springframework.test.context.junit4.SpringRunner
;
import
javax.annotation.Resource
;
import
java.util.Arrays
;
import
java.util.List
;
@RunWith
(
SpringRunner
.
class
)
...
...
@@ -25,7 +26,7 @@ public class XxlJobRegistryDaoTest {
List
<
XxlJobRegistry
>
list
=
xxlJobRegistryDao
.
findAll
(
1
);
int
ret2
=
xxlJobRegistryDao
.
removeDead
(
1
);
int
ret2
=
xxlJobRegistryDao
.
removeDead
(
Arrays
.
asList
(
1
)
);
}
}
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