Remove try-with-resources to make it work with jdk 1.8
This commit is contained in:
parent
5597bfa93e
commit
05d51acdc0
@ -10,6 +10,7 @@ import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
public class Main {
|
||||
|
||||
@ -44,16 +45,23 @@ public class Main {
|
||||
});
|
||||
AccessPoint.setTimeSlotNb(timeSlotNb);
|
||||
AccessPoint.setSubCarrierNb(subCarrierNb);
|
||||
try(ExecutorService executor = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors())) {
|
||||
for(int i = 2; i <= maximumLoad; i += 2) {
|
||||
List<User> users = generateUsers(i, timeSlotNb, subCarrierNb);
|
||||
ResourceBlock[][] frame = new ResourceBlock[timeSlotNb][subCarrierNb];
|
||||
Scheduler scheduler = new MaxSNR(frame, users);
|
||||
// Scheduler scheduler = new ProportionalFair(frame, users);
|
||||
// Scheduler scheduler = new RoundRobin(frame, users);
|
||||
AccessPoint accessPoint = new AccessPoint(scheduler, frame, users);
|
||||
executor.submit(() -> accessPoint.startSimulation(numberOfTicks));
|
||||
ExecutorService executor = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors());
|
||||
for(int i = 2; i <= maximumLoad; i += 2) {
|
||||
List<User> users = generateUsers(i, timeSlotNb, subCarrierNb);
|
||||
ResourceBlock[][] frame = new ResourceBlock[timeSlotNb][subCarrierNb];
|
||||
Scheduler scheduler = new MaxSNR(frame, users);
|
||||
// Scheduler scheduler = new ProportionalFair(frame, users);
|
||||
// Scheduler scheduler = new RoundRobin(frame, users);
|
||||
AccessPoint accessPoint = new AccessPoint(scheduler, frame, users);
|
||||
executor.submit(() -> accessPoint.startSimulation(numberOfTicks));
|
||||
}
|
||||
executor.shutdown();
|
||||
try {
|
||||
if(!executor.awaitTermination(2, TimeUnit.MINUTES)) {
|
||||
executor.shutdownNow();
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
System.err.println("Please give launch arguments");
|
||||
|
Reference in New Issue
Block a user