mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
fix code
This commit is contained in:
@@ -54,13 +54,13 @@ public class CronTimer extends Thread implements Serializable {
|
||||
long thisTime = System.currentTimeMillis();
|
||||
long nextTime;
|
||||
long sleep;
|
||||
while(! isStop){
|
||||
while(!isStop){
|
||||
//下一时间计算是按照上一个执行点开始时间计算的
|
||||
//此处除以定时单位是为了清零单位以下部分,例如单位是分则秒和毫秒清零
|
||||
nextTime = ((thisTime / timerUnit) + 1) * timerUnit;
|
||||
sleep = nextTime - System.currentTimeMillis();
|
||||
if(isValidSleepMillis(sleep, timerUnit)){
|
||||
if (! ThreadUtil.safeSleep(sleep)) {
|
||||
if (!ThreadUtil.safeSleep(sleep)) {
|
||||
//等待直到下一个时间点,如果被中断直接退出Timer
|
||||
break;
|
||||
}
|
||||
|
@@ -463,7 +463,7 @@ public class Scheduler implements Serializable {
|
||||
public Scheduler stop(final boolean clearTasks) {
|
||||
lock.lock();
|
||||
try {
|
||||
if (! started) {
|
||||
if (!started) {
|
||||
throw new IllegalStateException("Scheduler not started !");
|
||||
}
|
||||
|
||||
|
@@ -162,7 +162,7 @@ public class CronPattern {
|
||||
*/
|
||||
public Calendar nextMatchAfter(final Calendar calendar) {
|
||||
Calendar next = nextMatchAfter(PatternUtil.getFields(calendar, true), calendar.getTimeZone());
|
||||
if (! match(next, true)) {
|
||||
if (!match(next, true)) {
|
||||
next.set(Calendar.DAY_OF_MONTH, next.get(Calendar.DAY_OF_MONTH) + 1);
|
||||
next = CalendarUtil.beginOfDay(next);
|
||||
return nextMatchAfter(next);
|
||||
|
@@ -171,7 +171,7 @@ public class PartParser {
|
||||
if (value.length() <= 2) {
|
||||
//根据步进的第一个数字确定起始时间,类似于 12/3则从12(秒、分等)开始
|
||||
int minValue = part.getMin();
|
||||
if (! isMatchAllStr(value)) {
|
||||
if (!isMatchAllStr(value)) {
|
||||
minValue = Math.max(minValue, parseNumber(value));
|
||||
} else {
|
||||
//在全匹配模式下,如果步进不存在,表示步进为1
|
||||
|
@@ -70,7 +70,7 @@ public class SystemTimer {
|
||||
bossThreadPool = ThreadUtil.newSingleExecutor();
|
||||
bossThreadPool.submit(() -> {
|
||||
while (true) {
|
||||
if(! advanceClock()){
|
||||
if(!advanceClock()){
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -92,7 +92,7 @@ public class SystemTimer {
|
||||
*/
|
||||
public void addTask(final TimerTask timerTask) {
|
||||
//添加失败任务直接执行
|
||||
if (! timeWheel.addTask(timerTask)) {
|
||||
if (!timeWheel.addTask(timerTask)) {
|
||||
ThreadUtil.execAsync(timerTask.getTask());
|
||||
}
|
||||
}
|
||||
|
@@ -105,7 +105,7 @@ public class TimerTaskList implements Delayed {
|
||||
*/
|
||||
public synchronized void flush(final Consumer<TimerTask> flush) {
|
||||
TimerTask timerTask = root.next;
|
||||
while (! timerTask.equals(root)) {
|
||||
while (!timerTask.equals(root)) {
|
||||
this.removeTask(timerTask);
|
||||
flush.accept(timerTask);
|
||||
timerTask = root.next;
|
||||
|
Reference in New Issue
Block a user