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

@@ -21,6 +21,9 @@ package server;
import java.util.concurrent.*;
import static java.util.concurrent.TimeUnit.MINUTES;
import static java.util.concurrent.TimeUnit.SECONDS;
/**
* @author Ronan
*/
@@ -53,13 +56,13 @@ public class ThreadManager {
RejectedExecutionHandler reh = new RejectedExecutionHandlerImpl();
ThreadFactory tf = Executors.defaultThreadFactory();
tpe = new ThreadPoolExecutor(20, 1000, 77, TimeUnit.SECONDS, new ArrayBlockingQueue<>(50), tf, reh);
tpe = new ThreadPoolExecutor(20, 1000, 77, SECONDS, new ArrayBlockingQueue<>(50), tf, reh);
}
public void stop() {
tpe.shutdown();
try {
tpe.awaitTermination(5, TimeUnit.MINUTES);
tpe.awaitTermination(5, MINUTES);
} catch (InterruptedException ie) {
}
}

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) {

View File

@@ -33,9 +33,9 @@ import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
import static java.util.concurrent.TimeUnit.MINUTES;
import static java.util.concurrent.TimeUnit.SECONDS;
/**
* @author Ronan
@@ -65,7 +65,7 @@ public class AriantColiseum {
map.resetFully();
long pqTimer = MINUTES.toMillis(10);
long pqTimerBoard = MINUTES.toMillis(9) + TimeUnit.SECONDS.toMillis(50);
long pqTimerBoard = MINUTES.toMillis(9) + SECONDS.toMillis(50);
List<Character> players = exped.getActiveMembers();
score = new HashMap<>();