protected char[][] bitfieldBlocks = new char[Common.FILE_PIECES][Common.PIECES_BLOCKS];
protected short[] piecesCount = new short[Common.FILE_PIECES];
protected int piecesRequested = 0;
protected char[][] bitfieldBlocks = new char[Common.FILE_PIECES][Common.PIECES_BLOCKS];
protected short[] piecesCount = new short[Common.FILE_PIECES];
protected int piecesRequested = 0;
- protected ArrayList<Integer> currentPieces = new ArrayList<Integer>();
+ protected ArrayList<Integer> currentPieces = new ArrayList<>();
protected int currentPiece = -1;
protected int currentPiece = -1;
- protected HashMap<Integer, Connection> activePeers = new HashMap<Integer, Connection>();
- protected HashMap<Integer, Connection> peers = new HashMap<Integer, Connection>();
+ protected HashMap<Integer, Connection> activePeers = new HashMap<>();
+ protected HashMap<Integer, Connection> peers = new HashMap<>();
protected Comm commReceived = null;
public Peer(Host host, String name, String[]args) {
protected Comm commReceived = null;
public Peer(Host host, String name, String[]args) {
//Retrieve the end time
deadline = Double.parseDouble(args[0]);
//Building peers array
//Retrieve the end time
deadline = Double.parseDouble(args[0]);
//Building peers array
- peersList = new ArrayList<Integer>();
+ peersList = new ArrayList<>();
Msg.info("Tracker launched.");
while (Msg.getClock() < deadline) {
Msg.info("Tracker launched.");
while (Msg.getClock() < deadline) {
this.uploaded = uploaded;
this.downloaded = downloaded;
this.left = left;
this.uploaded = uploaded;
this.downloaded = downloaded;
this.left = left;
- this.peers = new ArrayList<Integer>();
+ this.peers = new ArrayList<>();
import org.simgrid.msg.MsgException;
public class Coordinator extends Process {
import org.simgrid.msg.MsgException;
public class Coordinator extends Process {
- LinkedList<RequestTask> waitingQueue=new LinkedList<RequestTask>();
+ LinkedList<RequestTask> waitingQueue=new LinkedList<>();
int csToServe;
public Coordinator(Host host, String name, String[]args) {
int csToServe;
public Coordinator(Host host, String name, String[]args) {
public void main(String[] args) throws MsgException {
int workersCount = Main.NHOSTS;
public void main(String[] args) throws MsgException {
int workersCount = Main.NHOSTS;
- ArrayList<VM> vms = new ArrayList<VM>();
+ ArrayList<VM> vms = new ArrayList<>();
// Create one VM per host and bind a process inside each one.
for (int i = 0; i < workersCount; i++) {
// Create one VM per host and bind a process inside each one.
for (int i = 0; i < workersCount; i++) {
- List<VM> vms = new ArrayList<VM>();
+ List<VM> vms = new ArrayList<>();
/* Create VM1 */
int dpRate = 70;
/* Create VM1 */
int dpRate = 70;
private int id;
public Bucket(int id) {
private int id;
public Bucket(int id) {
- this.nodes = new ArrayList<Integer>();
+ this.nodes = new ArrayList<>();
Task task = new Task(this.getHost().getName()+"-task", 300E6 , 0);
try {
task.execute();
Task task = new Task(this.getHost().getName()+"-task", 300E6 , 0);
try {
task.execute();
- } catch (HostFailureException | TaskCancelledException e) { // If your compiler fails on that multicatch, please proceed to Java 1.7 or higher
+ } catch (HostFailureException | TaskCancelledException e) {
Msg.error(e.getMessage());
e.printStackTrace();
}
Msg.error(e.getMessage());
e.printStackTrace();
}