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
19d1ac2e
authored
May 22, 2019
by
xuxueli
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
update document
parent
5c1f5932
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
20 deletions
xxl-job-admin/src/main/java/com/xxl/job/admin/core/thread/JobScheduleHelper.java
xxl-job-admin/src/main/java/com/xxl/job/admin/service/impl/XxlJobServiceImpl.java
xxl-job-admin/src/main/java/com/xxl/job/admin/core/thread/JobScheduleHelper.java
View file @
19d1ac2e
...
@@ -58,8 +58,8 @@ public class JobScheduleHelper {
...
@@ -58,8 +58,8 @@ public class JobScheduleHelper {
// tx start
// tx start
// 1、
查询JOB:"下次调度30s内"
// 1、
预读10s内调度任务
long
maxNextTime
=
System
.
currentTimeMillis
()
+
3
0000
;
long
maxNextTime
=
System
.
currentTimeMillis
()
+
1
0000
;
long
nowTime
=
System
.
currentTimeMillis
();
long
nowTime
=
System
.
currentTimeMillis
();
List
<
XxlJobInfo
>
scheduleList
=
XxlJobAdminConfig
.
getAdminConfig
().
getXxlJobInfoDao
().
scheduleJobQuery
(
maxNextTime
);
List
<
XxlJobInfo
>
scheduleList
=
XxlJobAdminConfig
.
getAdminConfig
().
getXxlJobInfoDao
().
scheduleJobQuery
(
maxNextTime
);
if
(
scheduleList
!=
null
&&
scheduleList
.
size
()>
0
)
{
if
(
scheduleList
!=
null
&&
scheduleList
.
size
()>
0
)
{
...
...
xxl-job-admin/src/main/java/com/xxl/job/admin/service/impl/XxlJobServiceImpl.java
View file @
19d1ac2e
...
@@ -189,13 +189,15 @@ public class XxlJobServiceImpl implements XxlJobService {
...
@@ -189,13 +189,15 @@ public class XxlJobServiceImpl implements XxlJobService {
return
new
ReturnT
<
String
>(
ReturnT
.
FAIL_CODE
,
(
I18nUtil
.
getString
(
"jobinfo_field_id"
)+
I18nUtil
.
getString
(
"system_not_found"
))
);
return
new
ReturnT
<
String
>(
ReturnT
.
FAIL_CODE
,
(
I18nUtil
.
getString
(
"jobinfo_field_id"
)+
I18nUtil
.
getString
(
"system_not_found"
))
);
}
}
// next trigger time
// next trigger time
(10s后生效,避开预读周期)
long
nextTriggerTime
=
0
;
long
nextTriggerTime
=
0
;
try
{
if
(
exists_jobInfo
.
getTriggerStatus
()
==
1
)
{
nextTriggerTime
=
new
CronExpression
(
jobInfo
.
getJobCron
()).
getNextValidTimeAfter
(
new
Date
()).
getTime
();
try
{
}
catch
(
ParseException
e
)
{
nextTriggerTime
=
new
CronExpression
(
jobInfo
.
getJobCron
()).
getNextValidTimeAfter
(
new
Date
(
System
.
currentTimeMillis
()
+
10000
)).
getTime
();
logger
.
error
(
e
.
getMessage
(),
e
);
}
catch
(
ParseException
e
)
{
return
new
ReturnT
<
String
>(
ReturnT
.
FAIL_CODE
,
I18nUtil
.
getString
(
"jobinfo_field_cron_unvalid"
)+
" | "
+
e
.
getMessage
());
logger
.
error
(
e
.
getMessage
(),
e
);
return
new
ReturnT
<
String
>(
ReturnT
.
FAIL_CODE
,
I18nUtil
.
getString
(
"jobinfo_field_cron_unvalid"
)+
" | "
+
e
.
getMessage
());
}
}
}
exists_jobInfo
.
setJobGroup
(
jobInfo
.
getJobGroup
());
exists_jobInfo
.
setJobGroup
(
jobInfo
.
getJobGroup
());
...
@@ -234,10 +236,10 @@ public class XxlJobServiceImpl implements XxlJobService {
...
@@ -234,10 +236,10 @@ public class XxlJobServiceImpl implements XxlJobService {
public
ReturnT
<
String
>
start
(
int
id
)
{
public
ReturnT
<
String
>
start
(
int
id
)
{
XxlJobInfo
xxlJobInfo
=
xxlJobInfoDao
.
loadById
(
id
);
XxlJobInfo
xxlJobInfo
=
xxlJobInfoDao
.
loadById
(
id
);
// next trigger time
// next trigger time
(10s后生效,避开预读周期)
long
nextTriggerTime
=
0
;
long
nextTriggerTime
=
0
;
try
{
try
{
nextTriggerTime
=
new
CronExpression
(
xxlJobInfo
.
getJobCron
()).
getNextValidTimeAfter
(
new
Date
()).
getTime
();
nextTriggerTime
=
new
CronExpression
(
xxlJobInfo
.
getJobCron
()).
getNextValidTimeAfter
(
new
Date
(
System
.
currentTimeMillis
()
+
10000
)).
getTime
();
}
catch
(
ParseException
e
)
{
}
catch
(
ParseException
e
)
{
logger
.
error
(
e
.
getMessage
(),
e
);
logger
.
error
(
e
.
getMessage
(),
e
);
return
new
ReturnT
<
String
>(
ReturnT
.
FAIL_CODE
,
I18nUtil
.
getString
(
"jobinfo_field_cron_unvalid"
)+
" | "
+
e
.
getMessage
());
return
new
ReturnT
<
String
>(
ReturnT
.
FAIL_CODE
,
I18nUtil
.
getString
(
"jobinfo_field_cron_unvalid"
)+
" | "
+
e
.
getMessage
());
...
@@ -255,18 +257,9 @@ public class XxlJobServiceImpl implements XxlJobService {
...
@@ -255,18 +257,9 @@ public class XxlJobServiceImpl implements XxlJobService {
public
ReturnT
<
String
>
stop
(
int
id
)
{
public
ReturnT
<
String
>
stop
(
int
id
)
{
XxlJobInfo
xxlJobInfo
=
xxlJobInfoDao
.
loadById
(
id
);
XxlJobInfo
xxlJobInfo
=
xxlJobInfoDao
.
loadById
(
id
);
// next trigger time
long
nextTriggerTime
=
0
;
try
{
nextTriggerTime
=
new
CronExpression
(
xxlJobInfo
.
getJobCron
()).
getNextValidTimeAfter
(
new
Date
()).
getTime
();
}
catch
(
ParseException
e
)
{
logger
.
error
(
e
.
getMessage
(),
e
);
return
new
ReturnT
<
String
>(
ReturnT
.
FAIL_CODE
,
I18nUtil
.
getString
(
"jobinfo_field_cron_unvalid"
)+
" | "
+
e
.
getMessage
());
}
xxlJobInfo
.
setTriggerStatus
(
0
);
xxlJobInfo
.
setTriggerStatus
(
0
);
xxlJobInfo
.
setTriggerLastTime
(
0
);
xxlJobInfo
.
setTriggerLastTime
(
0
);
xxlJobInfo
.
setTriggerNextTime
(
nextTriggerTime
);
xxlJobInfo
.
setTriggerNextTime
(
0
);
xxlJobInfoDao
.
update
(
xxlJobInfo
);
xxlJobInfoDao
.
update
(
xxlJobInfo
);
return
ReturnT
.
SUCCESS
;
return
ReturnT
.
SUCCESS
;
...
...
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