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
72383d94
authored
Oct 27, 2018
by
xuxueli
Browse files
Options
_('Browse Files')
Download
Plain Diff
Merge branch 'master' of
https://github.com/xuxueli/xxl-job
parents
0142b353
ecd0b24a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
8 deletions
xxl-job-core/src/main/java/com/xxl/job/core/executor/XxlJobExecutor.java
xxl-job-core/src/main/java/com/xxl/job/core/executor/XxlJobExecutor.java
View file @
72383d94
...
@@ -88,12 +88,12 @@ public class XxlJobExecutor implements ApplicationContextAware {
...
@@ -88,12 +88,12 @@ public class XxlJobExecutor implements ApplicationContextAware {
JobLogFileCleanThread
.
getInstance
().
start
(
logRetentionDays
);
JobLogFileCleanThread
.
getInstance
().
start
(
logRetentionDays
);
}
}
public
void
destroy
(){
public
void
destroy
(){
// destory
J
obThreadRepository
// destory
j
obThreadRepository
if
(
J
obThreadRepository
.
size
()
>
0
)
{
if
(
j
obThreadRepository
.
size
()
>
0
)
{
for
(
Map
.
Entry
<
Integer
,
JobThread
>
item:
J
obThreadRepository
.
entrySet
())
{
for
(
Map
.
Entry
<
Integer
,
JobThread
>
item:
j
obThreadRepository
.
entrySet
())
{
removeJobThread
(
item
.
getKey
(),
"web container destroy and kill the job."
);
removeJobThread
(
item
.
getKey
(),
"web container destroy and kill the job."
);
}
}
J
obThreadRepository
.
clear
();
j
obThreadRepository
.
clear
();
}
}
// destory executor-server
// destory executor-server
...
@@ -174,13 +174,13 @@ public class XxlJobExecutor implements ApplicationContextAware {
...
@@ -174,13 +174,13 @@ public class XxlJobExecutor implements ApplicationContextAware {
// ---------------------- job thread repository ----------------------
// ---------------------- job thread repository ----------------------
private
static
ConcurrentHashMap
<
Integer
,
JobThread
>
J
obThreadRepository
=
new
ConcurrentHashMap
<
Integer
,
JobThread
>();
private
static
ConcurrentHashMap
<
Integer
,
JobThread
>
j
obThreadRepository
=
new
ConcurrentHashMap
<
Integer
,
JobThread
>();
public
static
JobThread
registJobThread
(
int
jobId
,
IJobHandler
handler
,
String
removeOldReason
){
public
static
JobThread
registJobThread
(
int
jobId
,
IJobHandler
handler
,
String
removeOldReason
){
JobThread
newJobThread
=
new
JobThread
(
jobId
,
handler
);
JobThread
newJobThread
=
new
JobThread
(
jobId
,
handler
);
newJobThread
.
start
();
newJobThread
.
start
();
logger
.
info
(
">>>>>>>>>>> xxl-job regist JobThread success, jobId:{}, handler:{}"
,
new
Object
[]{
jobId
,
handler
});
logger
.
info
(
">>>>>>>>>>> xxl-job regist JobThread success, jobId:{}, handler:{}"
,
new
Object
[]{
jobId
,
handler
});
JobThread
oldJobThread
=
J
obThreadRepository
.
put
(
jobId
,
newJobThread
);
// putIfAbsent | oh my god, map's put method return the old value!!!
JobThread
oldJobThread
=
j
obThreadRepository
.
put
(
jobId
,
newJobThread
);
// putIfAbsent | oh my god, map's put method return the old value!!!
if
(
oldJobThread
!=
null
)
{
if
(
oldJobThread
!=
null
)
{
oldJobThread
.
toStop
(
removeOldReason
);
oldJobThread
.
toStop
(
removeOldReason
);
oldJobThread
.
interrupt
();
oldJobThread
.
interrupt
();
...
@@ -189,14 +189,14 @@ public class XxlJobExecutor implements ApplicationContextAware {
...
@@ -189,14 +189,14 @@ public class XxlJobExecutor implements ApplicationContextAware {
return
newJobThread
;
return
newJobThread
;
}
}
public
static
void
removeJobThread
(
int
jobId
,
String
removeOldReason
){
public
static
void
removeJobThread
(
int
jobId
,
String
removeOldReason
){
JobThread
oldJobThread
=
J
obThreadRepository
.
remove
(
jobId
);
JobThread
oldJobThread
=
j
obThreadRepository
.
remove
(
jobId
);
if
(
oldJobThread
!=
null
)
{
if
(
oldJobThread
!=
null
)
{
oldJobThread
.
toStop
(
removeOldReason
);
oldJobThread
.
toStop
(
removeOldReason
);
oldJobThread
.
interrupt
();
oldJobThread
.
interrupt
();
}
}
}
}
public
static
JobThread
loadJobThread
(
int
jobId
){
public
static
JobThread
loadJobThread
(
int
jobId
){
JobThread
jobThread
=
J
obThreadRepository
.
get
(
jobId
);
JobThread
jobThread
=
j
obThreadRepository
.
get
(
jobId
);
return
jobThread
;
return
jobThread
;
}
}
...
...
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