Fix for jdk 1.8
This commit is contained in:
parent
df77238cc9
commit
9936d4f1b9
@ -12,6 +12,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 {
|
||||
|
||||
@ -52,27 +53,33 @@ public class Main {
|
||||
});
|
||||
Cell.setTimeSlotNb(timeSlotNb);
|
||||
Cell.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];
|
||||
//TODO : changes schedulers
|
||||
Scheduler schedulerCell1 = new RoundRobin(frame, users);
|
||||
Scheduler schedulerCell2 = new RoundRobin(frame, users);
|
||||
try{
|
||||
FileOutputStream output = new FileOutputStream("export" + File.separator + users.size() + ".csv", true);
|
||||
output.write("tick;x;y;user;bandwidth;delay;cell;\n".getBytes());
|
||||
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];
|
||||
//TODO : changes schedulers
|
||||
Scheduler schedulerCell1 = new RoundRobin(frame, users);
|
||||
Scheduler schedulerCell2 = new RoundRobin(frame, users);
|
||||
try{
|
||||
FileOutputStream output = new FileOutputStream("export" + File.separator + users.size() + ".csv", true);
|
||||
output.write("tick;x;y;user;bandwidth;delay;cell;\n".getBytes());
|
||||
|
||||
Cell cell1 = new Cell(0, schedulerCell1, frame, users, output);
|
||||
Cell cell2 = new Cell(1, schedulerCell2, frame, users, output);
|
||||
AccessPoint accessPoint = new AccessPoint(cell1, cell2);
|
||||
executor.submit(() -> accessPoint.startSimulation(numberOfTicks, users));
|
||||
} catch(IOException e) {
|
||||
System.err.println(e.getClass().getSimpleName() + " : " + e.getMessage());
|
||||
System.exit(1);
|
||||
}
|
||||
Cell cell1 = new Cell(0, schedulerCell1, frame, users, output);
|
||||
Cell cell2 = new Cell(1, schedulerCell2, frame, users, output);
|
||||
AccessPoint accessPoint = new AccessPoint(cell1, cell2);
|
||||
executor.submit(() -> accessPoint.startSimulation(numberOfTicks, users));
|
||||
} catch(IOException e) {
|
||||
System.err.println(e.getClass().getSimpleName() + " : " + e.getMessage());
|
||||
System.exit(1);
|
||||
}
|
||||
}
|
||||
executor.shutdown();
|
||||
try {
|
||||
executor.awaitTermination(2, TimeUnit.MINUTES);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
executor.shutdownNow();
|
||||
} else {
|
||||
System.err.println("Please give launch arguments");
|
||||
System.err.println("gradle run --args=\"<number of ticks> <number of users>\"");
|
||||
|
@ -45,9 +45,9 @@ public class User {
|
||||
public void createPackets(int m, int ticks) {
|
||||
timeInterval--;
|
||||
if(timeInterval == 0) {
|
||||
timeInterval = random.nextInt(50, 101);
|
||||
timeInterval = 50 + random.nextInt(51);
|
||||
// On tire un nombre entre 0 et 2 * m
|
||||
mbis = random.nextInt(1, 2 * m + 1) ;
|
||||
mbis = 1 + random.nextInt(2 * m + 1) ;
|
||||
|
||||
}
|
||||
// On calcule le nombre de paquets qu'on peut transmettre
|
||||
|
Reference in New Issue
Block a user