Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
熊鹏飞
/
xxljob220
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
9f5267c2
authored
Mar 28, 2020
by
xuxueli
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
执行器优雅停机优化,修复任务线程中断未join导致回调丢失的问题;
parent
ebe88bd7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
25 deletions
doc/XXL-JOB官方文档.md
xxl-job-core/src/main/java/com/xxl/job/core/executor/XxlJobExecutor.java
doc/XXL-JOB官方文档.md
View file @
9f5267c2
## 《分
布式任务调度平台XXL-JOB》
## 《分
布式任务调度平台XXL-JOB》
...
...
@@ -1716,13 +1716,14 @@ public ReturnT<String> execute(String param) {
-
10、移除旧类注解JobHandler,推荐使用基于方法注解 "@XxlJob" 的方式进行任务开发;(如需保留类注解JobHandler使用方式,可以参考旧版逻辑定制开发);
-
11、修复bootstrap.min.css.map 404问题;
-
12、XxlJob注解扫描方式优化,支持查找父类以及接口和基于类代理等常见情况;
-
13、
[
迭代中
]
自定义失败重试时间间隔;
-
14、
[
迭代中
]
任务复制功能;点击复制是弹出新建任务弹框,并初始化被复制任务信息;
-
15、
[
迭代中
]
新增执行器描述、任务描述属性;
-
16、
[
迭代中
]
任务执行一次的时候指定IP;
-
17、
[
迭代中
]
任务日志支持单个清理和状态转移,方便触发子任务;
-
18、
[
迭代中
]
任务结果丢失处理:针对长期处于运行中的任务(设置过期时间时,运行超过"过期时间+1min";未设置超时时间时,运行超过"30min"),主动检测该执行器是否在线,如果不在线主动标记失败;
-
19、
[
迭代中
]
优雅停机回调丢失问题修复;
-
13、执行器优雅停机优化,修复任务线程中断未join导致回调丢失的问题;
-
14、
[
迭代中
]
自定义失败重试时间间隔;
-
15、
[
迭代中
]
任务复制功能;点击复制是弹出新建任务弹框,并初始化被复制任务信息;
-
16、
[
迭代中
]
新增执行器描述、任务描述属性;
-
17、
[
迭代中
]
任务执行一次的时候指定IP;
-
18、
[
迭代中
]
任务日志支持单个清理和状态转移,方便触发子任务;
-
19、
[
迭代中
]
任务结果丢失处理:针对长期处于运行中的任务(设置过期时间时,运行超过"过期时间+1min";未设置超时时间时,运行超过"30min"),主动检测该执行器是否在线,如果不在线主动标记失败;
-
20、
[
迭代中
]
优雅停机回调丢失问题修复;
### TODO LIST
...
...
xxl-job-core/src/main/java/com/xxl/job/core/executor/XxlJobExecutor.java
View file @
9f5267c2
...
...
@@ -84,33 +84,26 @@ public class XxlJobExecutor {
initRpcProvider
(
ip
,
port
,
appName
,
accessToken
);
}
public
void
destroy
(){
List
<
JobThread
>
runningThreads
=
new
ArrayList
<>(
jobThreadRepository
.
values
());
if
(
logger
.
isInfoEnabled
())
{
logger
.
info
(
"running threads {}"
,
runningThreads
);
}
// destory executor-server
stopRpcProvider
();
// destory jobThreadRepository
if
(
jobThreadRepository
.
size
()
>
0
)
{
for
(
Map
.
Entry
<
Integer
,
JobThread
>
item:
jobThreadRepository
.
entrySet
())
{
removeJobThread
(
item
.
getKey
(),
"web container destroy and kill the job."
);
JobThread
oldJobThread
=
removeJobThread
(
item
.
getKey
(),
"web container destroy and kill the job."
);
// wait for job thread push result to callback queue
if
(
oldJobThread
!=
null
)
{
try
{
oldJobThread
.
join
();
}
catch
(
InterruptedException
e
)
{
logger
.
error
(
">>>>>>>>>>> xxl-job, JobThread destroy(join) error, jobId:{}"
,
item
.
getKey
(),
e
);
}
}
}
jobThreadRepository
.
clear
();
}
jobHandlerRepository
.
clear
();
for
(
JobThread
runningThread
:
runningThreads
)
{
try
{
// wait for all job thread push result to callback queue
runningThread
.
join
();
}
catch
(
InterruptedException
e
)
{
logger
.
warn
(
"interrupted while stopping {}"
,
runningThread
);
break
;
}
}
// destory JobLogFileCleanThread
JobLogFileCleanThread
.
getInstance
().
toStop
();
...
...
@@ -246,12 +239,15 @@ public class XxlJobExecutor {
return
newJobThread
;
}
public
static
voi
d
removeJobThread
(
int
jobId
,
String
removeOldReason
){
public
static
JobThrea
d
removeJobThread
(
int
jobId
,
String
removeOldReason
){
JobThread
oldJobThread
=
jobThreadRepository
.
remove
(
jobId
);
if
(
oldJobThread
!=
null
)
{
oldJobThread
.
toStop
(
removeOldReason
);
oldJobThread
.
interrupt
();
return
oldJobThread
;
}
return
null
;
}
public
static
JobThread
loadJobThread
(
int
jobId
){
JobThread
jobThread
=
jobThreadRepository
.
get
(
jobId
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment