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 c00a2995
authored
Jul 18, 2019
by
xuxueli
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
任务触发组件优化,常规1s预加载一次,预加载轮空时主动休眠4s,降低加载频率以及对DB压力;
1 parent
bee089b8
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
6 deletions
doc/XXL-JOB官方文档.md
xxl-job-admin/src/main/java/com/xxl/job/admin/core/thread/JobScheduleHelper.java
doc/XXL-JOB官方文档.md
View file @
c00a299
...
@@ -1517,7 +1517,7 @@ Tips: 历史版本(V1.3.x)目前已经Release至稳定版本, 进入维护阶段
...
@@ -1517,7 +1517,7 @@ Tips: 历史版本(V1.3.x)目前已经Release至稳定版本, 进入维护阶段
-
6、登录界面取消默认填写的登录账号密码;
-
6、登录界面取消默认填写的登录账号密码;
-
7、
[
ING
]
cron在线生成工具;
-
7、
[
ING
]
cron在线生成工具;
-
8、
[
ING
]
任务、执行器数据全量本地缓存;新增消息表广播通知;
-
8、
[
ING
]
任务、执行器数据全量本地缓存;新增消息表广播通知;
-
9、
[
ING
]
任务触发组件优化,常规1s预加载一次,轮空时主动休眠4s
;
-
9、
任务触发组件优化,常规1s预加载一次,预加载轮空时主动休眠4s,降低加载频率以及对DB压力
;
-
10、注册监控线程优化,降低死锁几率;
-
10、注册监控线程优化,降低死锁几率;
-
11、调度组件优化:针对永远不会触发的Cron禁止配置和启动;任务Cron最后一次触发后再也不会触发时,比如一次性任务,主动停止相关任务;
-
11、调度组件优化:针对永远不会触发的Cron禁止配置和启动;任务Cron最后一次触发后再也不会触发时,比如一次性任务,主动停止相关任务;
-
12、任务列表交互优化,支持查看任务所属执行器的注册节点;
-
12、任务列表交互优化,支持查看任务所属执行器的注册节点;
...
...
xxl-job-admin/src/main/java/com/xxl/job/admin/core/thread/JobScheduleHelper.java
View file @
c00a299
...
@@ -52,9 +52,10 @@ public class JobScheduleHelper {
...
@@ -52,9 +52,10 @@ public class JobScheduleHelper {
Connection
conn
=
null
;
Connection
conn
=
null
;
while
(!
scheduleThreadToStop
)
{
while
(!
scheduleThreadToStop
)
{
//
扫描任务
//
Scan Job
long
start
=
System
.
currentTimeMillis
();
long
start
=
System
.
currentTimeMillis
();
PreparedStatement
preparedStatement
=
null
;
PreparedStatement
preparedStatement
=
null
;
boolean
preReadSuc
=
true
;
try
{
try
{
if
(
conn
==
null
||
conn
.
isClosed
())
{
if
(
conn
==
null
||
conn
.
isClosed
())
{
conn
=
XxlJobAdminConfig
.
getAdminConfig
().
getDataSource
().
getConnection
();
conn
=
XxlJobAdminConfig
.
getAdminConfig
().
getDataSource
().
getConnection
();
...
@@ -154,6 +155,8 @@ public class JobScheduleHelper {
...
@@ -154,6 +155,8 @@ public class JobScheduleHelper {
XxlJobAdminConfig
.
getAdminConfig
().
getXxlJobInfoDao
().
scheduleUpdate
(
jobInfo
);
XxlJobAdminConfig
.
getAdminConfig
().
getXxlJobInfoDao
().
scheduleUpdate
(
jobInfo
);
}
}
}
else
{
preReadSuc
=
false
;
}
}
// tx stop
// tx stop
...
@@ -187,16 +190,19 @@ public class JobScheduleHelper {
...
@@ -187,16 +190,19 @@ public class JobScheduleHelper {
}
}
long
cost
=
System
.
currentTimeMillis
()-
start
;
long
cost
=
System
.
currentTimeMillis
()-
start
;
// next second, align second
// Wait seconds, align second
if
(
cost
<
1000
)
{
// scan-overtime, not wait
try
{
try
{
if
(
cost
<
1000
)
{
// pre-read success, exist job in 5s, wait 1s;
TimeUnit
.
MILLISECONDS
.
sleep
(
1000
-
System
.
currentTimeMillis
()%
1000
);
// pre-read fail, no exist job in 5s, wait 1s
}
TimeUnit
.
MILLISECONDS
.
sleep
((
preReadSuc
?
1000
:
4000
)
-
System
.
currentTimeMillis
()%
1000
);
}
catch
(
InterruptedException
e
)
{
}
catch
(
InterruptedException
e
)
{
if
(!
scheduleThreadToStop
)
{
if
(!
scheduleThreadToStop
)
{
logger
.
error
(
e
.
getMessage
(),
e
);
logger
.
error
(
e
.
getMessage
(),
e
);
}
}
}
}
}
}
}
if
(
conn
!=
null
)
{
if
(
conn
!=
null
)
{
...
...
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