修复:重置执行周期丢失执行任务 bug
This commit is contained in:
parent
f201a8fe64
commit
363cb73ae7
1
pom.xml
1
pom.xml
@ -18,6 +18,7 @@
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<finalName>redtimer</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
|
@ -39,7 +39,7 @@ public class TimerTask implements Task {
|
||||
@Override
|
||||
public void setScheduled(Scheduled scheduled) {
|
||||
this.scheduled = scheduled;
|
||||
this.theTime = Date.from(scheduled.theTime().atZone(ZoneId.systemDefault()).toInstant()).getTime();
|
||||
//this.theTime = Date.from(scheduled.theTime().atZone(ZoneId.systemDefault()).toInstant()).getTime();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -25,7 +25,7 @@ public class TimerQueue {
|
||||
lock.lock();
|
||||
remove(task.getName());
|
||||
int inx = queue.size();//目标坐标
|
||||
while (inx > 0 && queue.get(inx).theTime() > task.theTime()) {
|
||||
while (inx > 0 && queue.get(inx - 1).theTime() > task.theTime()) {
|
||||
inx--;
|
||||
}
|
||||
|
||||
|
@ -66,6 +66,9 @@ public class ScheduledCycle implements Scheduled {
|
||||
|
||||
@Override
|
||||
public LocalDateTime nextTime() {
|
||||
if (theTime.isAfter(LocalDateTime.now())) {
|
||||
return theTime;
|
||||
}
|
||||
return theTime = theTime.plus(period, unit);
|
||||
}
|
||||
|
||||
|
@ -112,6 +112,9 @@ public class ScheduledExpres implements Scheduled {
|
||||
*/
|
||||
@Override
|
||||
public LocalDateTime nextTime() {
|
||||
if (theTime.isAfter(LocalDateTime.now())) {
|
||||
return theTime;
|
||||
}
|
||||
return theTime = carry("m");
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user