格式调整
This commit is contained in:
parent
2a085daa2a
commit
080c6d22ee
@ -37,6 +37,7 @@ public class TimerExecutor {
|
||||
public Task remove(String name) {
|
||||
return queue.remove(name);
|
||||
}
|
||||
|
||||
public Task get(String name) {
|
||||
return queue.get(name);
|
||||
}
|
||||
|
@ -7,7 +7,6 @@ import net.tccn.timer.task.Task;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.util.Date;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
/**
|
||||
@ -52,6 +51,7 @@ public class TimerTask implements Task {
|
||||
System.out.println("下次执行:"+ sdf.format(next.toInstant(ZoneOffset.of("+8")).toEpochMilli()));*/
|
||||
return theTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long theTime() {
|
||||
LocalDateTime next = scheduled.theTime();
|
||||
|
@ -17,6 +17,7 @@ public class TimerQueue{
|
||||
|
||||
/**
|
||||
* 新加调度任务
|
||||
*
|
||||
* @param task
|
||||
*/
|
||||
public void push(Task task) {
|
||||
@ -43,6 +44,7 @@ public class TimerQueue{
|
||||
|
||||
/**
|
||||
* 调度等待执行的任务
|
||||
*
|
||||
* @return
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
@ -70,6 +72,7 @@ public class TimerQueue{
|
||||
|
||||
/**
|
||||
* 删除指定名称的任务
|
||||
*
|
||||
* @param name
|
||||
* @return
|
||||
*/
|
||||
@ -79,6 +82,7 @@ public class TimerQueue{
|
||||
|
||||
/**
|
||||
* 返回指定名称的任务
|
||||
*
|
||||
* @param name
|
||||
* @return
|
||||
*/
|
||||
|
@ -9,12 +9,14 @@ public interface Scheduled {
|
||||
|
||||
/**
|
||||
* 下次执行时间
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
LocalDateTime nextTime();
|
||||
|
||||
/**
|
||||
* 当前执行时间
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
LocalDateTime theTime();
|
||||
|
@ -8,6 +8,7 @@ import java.util.List;
|
||||
|
||||
/**
|
||||
* 时间解析器
|
||||
*
|
||||
* @author: liangxianyou
|
||||
*/
|
||||
@SuppressWarnings("Duplicates")
|
||||
@ -24,6 +25,7 @@ public class ScheduledExpres implements Scheduled{
|
||||
private String[] cfgArr;
|
||||
private LocalDateTime theTime;
|
||||
private int _y, _M, _d, _H, _m;
|
||||
|
||||
@Deprecated
|
||||
private ScheduledExpres(String cfg) {
|
||||
this.cfg = cfg;
|
||||
@ -38,9 +40,11 @@ public class ScheduledExpres implements Scheduled{
|
||||
this.cfg = cfg;
|
||||
initTheTime();
|
||||
}
|
||||
|
||||
public static Scheduled of(String cfg) {
|
||||
return new ScheduledExpres(cfg);
|
||||
}
|
||||
|
||||
public static Scheduled of(final LocalDateTime startTime, String cfg) {
|
||||
return new ScheduledExpres(startTime, cfg);
|
||||
}
|
||||
@ -103,6 +107,7 @@ public class ScheduledExpres implements Scheduled{
|
||||
|
||||
/**
|
||||
* 下一次执行的时间
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
@ -117,6 +122,7 @@ public class ScheduledExpres implements Scheduled{
|
||||
|
||||
/**
|
||||
* 通过发送指令进行进位
|
||||
*
|
||||
* @param cmd 进位指令
|
||||
*/
|
||||
private LocalDateTime carry(String cmd) {
|
||||
@ -202,6 +208,7 @@ public class ScheduledExpres implements Scheduled{
|
||||
|
||||
/**
|
||||
* 得到初始合法时间的索引
|
||||
*
|
||||
* @param arr 合法时间序列
|
||||
* @param n 初始选中值
|
||||
* @return 合法时间的索引
|
||||
@ -224,7 +231,9 @@ public class ScheduledExpres implements Scheduled{
|
||||
return -1;
|
||||
}
|
||||
|
||||
/** 以下为 初始化合法时间 weeks,monthes,days,hour,minutes 序列 */
|
||||
/**
|
||||
* 以下为 初始化合法时间 weeks,monthes,days,hour,minutes 序列
|
||||
*/
|
||||
private void setMinutes() {
|
||||
String cfg = cfgArr[0];
|
||||
if ("*".equals(cfg)) {//*
|
||||
|
@ -24,6 +24,7 @@ public interface Task extends Runnable {
|
||||
|
||||
/**
|
||||
* 得到下一次执行计划的时间,并设置thenTime
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
long nextTime();
|
||||
@ -37,18 +38,21 @@ public interface Task extends Runnable {
|
||||
|
||||
/**
|
||||
* 是否完成
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
boolean isComplete();
|
||||
|
||||
/**
|
||||
* 完成任务(结束标记)
|
||||
*
|
||||
* @param complete
|
||||
*/
|
||||
void setComplete(boolean complete);
|
||||
|
||||
/**
|
||||
* 开始时间(创建时间)
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
long startTime();
|
||||
|
Loading…
Reference in New Issue
Block a user