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
ecd0b24a
authored
Oct 27, 2018
by
许雪里
Committed by
GitHub
Oct 27, 2018
Browse files
Options
_('Browse Files')
Download
Plain Diff
Merge pull request #523 from gpqhl0071/master
命名规范修正
parents
d4c9eb5d
c3697559
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 @
ecd0b24a
...
...
@@ -88,12 +88,12 @@ public class XxlJobExecutor implements ApplicationContextAware {
JobLogFileCleanThread
.
getInstance
().
start
(
logRetentionDays
);
}
public
void
destroy
(){
// destory
J
obThreadRepository
if
(
J
obThreadRepository
.
size
()
>
0
)
{
for
(
Map
.
Entry
<
Integer
,
JobThread
>
item:
J
obThreadRepository
.
entrySet
())
{
// destory
j
obThreadRepository
if
(
j
obThreadRepository
.
size
()
>
0
)
{
for
(
Map
.
Entry
<
Integer
,
JobThread
>
item:
j
obThreadRepository
.
entrySet
())
{
removeJobThread
(
item
.
getKey
(),
"web container destroy and kill the job."
);
}
J
obThreadRepository
.
clear
();
j
obThreadRepository
.
clear
();
}
// destory executor-server
...
...
@@ -174,13 +174,13 @@ public class XxlJobExecutor implements ApplicationContextAware {
// ---------------------- 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
){
JobThread
newJobThread
=
new
JobThread
(
jobId
,
handler
);
newJobThread
.
start
();
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
)
{
oldJobThread
.
toStop
(
removeOldReason
);
oldJobThread
.
interrupt
();
...
...
@@ -189,14 +189,14 @@ public class XxlJobExecutor implements ApplicationContextAware {
return
newJobThread
;
}
public
static
void
removeJobThread
(
int
jobId
,
String
removeOldReason
){
JobThread
oldJobThread
=
J
obThreadRepository
.
remove
(
jobId
);
JobThread
oldJobThread
=
j
obThreadRepository
.
remove
(
jobId
);
if
(
oldJobThread
!=
null
)
{
oldJobThread
.
toStop
(
removeOldReason
);
oldJobThread
.
interrupt
();
}
}
public
static
JobThread
loadJobThread
(
int
jobId
){
JobThread
jobThread
=
J
obThreadRepository
.
get
(
jobId
);
JobThread
jobThread
=
j
obThreadRepository
.
get
(
jobId
);
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