Fix for older jdk versions

This commit is contained in:
Quentin Legot 2023-04-07 11:32:41 +02:00
parent 28d3596eb9
commit 54f5c1636f

View File

@ -1,5 +1,7 @@
package fr.ntr; package fr.ntr;
import fr.ntr.scheduler.MaxSNR;
import fr.ntr.scheduler.ProportionalFair;
import fr.ntr.scheduler.RoundRobin; import fr.ntr.scheduler.RoundRobin;
import fr.ntr.scheduler.Scheduler; import fr.ntr.scheduler.Scheduler;
@ -13,6 +15,7 @@ import java.util.Objects;
import java.util.Random; import java.util.Random;
import java.util.concurrent.ExecutorService; import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
public class Main { public class Main {
@ -100,7 +103,15 @@ public class Main {
System.exit(1); System.exit(1);
} }
} }
executor.close(); executor.shutdown();
try {
executor.awaitTermination(2, TimeUnit.MINUTES);
}
catch (InterruptedException e) {
e.printStackTrace();
}
executor.shutdownNow();
System.out.println("Executor closed"); System.out.println("Executor closed");
} }
else { else {