Fix missing static imports of TimeUnit

This commit is contained in:
P0nk
2021-09-10 19:18:20 +02:00
parent cdc17ef3dd
commit 8b60684103
10 changed files with 40 additions and 28 deletions

View File

@@ -30,9 +30,11 @@ import java.lang.management.ManagementFactory;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import static java.util.concurrent.TimeUnit.MILLISECONDS;
import static java.util.concurrent.TimeUnit.MINUTES;
public class TimerManager implements TimerManagerMBean {
private static final TimerManager instance = new TimerManager();
@@ -69,7 +71,7 @@ public class TimerManager implements TimerManagerMBean {
stpe.setContinueExistingPeriodicTasksAfterShutdownPolicy(false);
stpe.setRemoveOnCancelPolicy(true);
stpe.setKeepAliveTime(5, TimeUnit.MINUTES);
stpe.setKeepAliveTime(5, MINUTES);
stpe.allowCoreThreadTimeOut(true);
ses = stpe;
@@ -87,15 +89,15 @@ public class TimerManager implements TimerManagerMBean {
}
public ScheduledFuture<?> register(Runnable r, long repeatTime, long delay) {
return ses.scheduleAtFixedRate(new LoggingSaveRunnable(r), delay, repeatTime, TimeUnit.MILLISECONDS);
return ses.scheduleAtFixedRate(new LoggingSaveRunnable(r), delay, repeatTime, MILLISECONDS);
}
public ScheduledFuture<?> register(Runnable r, long repeatTime) {
return ses.scheduleAtFixedRate(new LoggingSaveRunnable(r), 0, repeatTime, TimeUnit.MILLISECONDS);
return ses.scheduleAtFixedRate(new LoggingSaveRunnable(r), 0, repeatTime, MILLISECONDS);
}
public ScheduledFuture<?> schedule(Runnable r, long delay) {
return ses.schedule(new LoggingSaveRunnable(r), delay, TimeUnit.MILLISECONDS);
return ses.schedule(new LoggingSaveRunnable(r), delay, MILLISECONDS);
}
public ScheduledFuture<?> scheduleAtTimestamp(Runnable r, long timestamp) {