8000 -Comment removed from main · umeer/DistributedAlgorithms@e7411a3 · GitHub
[go: up one dir, main page]

Skip to content

Commit e7411a3

Browse files
umohammadumohammad
authored andcommitted
-Comment removed from main
1 parent 32cf17e commit e7411a3

File tree

1 file changed

+21
-19
lines changed

1 file changed

+21
-19
lines changed

DistributedAlgorithm2/src/distributedalgorithm2/DistributedAlgorithm2.java

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ public static void main(String[] args) throws RemoteException, MalformedURLExcep
3535
}
3636
System.setProperty(("java.rmi.server.hostname"), "127.0.0.1");
3737

38+
39+
40+
41+
3842
List<ProcessInterface> processList = new ArrayList<ProcessInterface>();
3943
for (int i = 1; i < NUMBER_OF_COMPONENT + 1; i++) {
4044
//Creation of process
@@ -44,31 +48,22 @@ public static void main(String[] args) throws RemoteException, MalformedURLExcep
4448
processList.add((ProcessInterface) Naming.lookup("rmi://localhost:1101/" + (i)));
4549
}
4650

47-
// //Setting up network of process
48-
// Naming.rebind("rmi://localhost:1101/p1", new Component(1));
49-
// //Naming.rebind("rmi://localhost:1100/p2", new Process("p2"));
50-
// //Naming.rebind("rmi://localhost:1100/p3", new Process("p3"));
51-
//
52-
// List<ProcessInterface> processList = new ArrayList<ProcessInterface>();
53-
// processList.add((ProcessInterface) Naming.lookup("rmi://localhost:1101/p1"));
54-
// processList.add((ProcessInterface) Naming.lookup("rmi://localhost:1102/p2"));
55-
// processList.add((ProcessInterface) Naming.lookup("rmi://localhost:1103/p3"));
51+
//Acknolege each process of the existance of other process
5652
for (ProcessInterface p : processList) {
5753
p.setNeighbor(processList);
58-
//System.out.println("Hi i'm process: " + p.getID());
5954
}
6055

61-
// //Start comunication
62-
// processList.get(0).broadcast("Ciao");
63-
// processList.get(0).broadcast("Ciao2");
64-
// processList.get(0).broadcast("Ciao3");
65-
//Thread.sleep(3000);
66-
//List<String> deliveredMessage = processList.get(0).getDeliveredMessage();
67-
// for (String message : deliveredMessage) {
68-
// System.out.println("I recevive: " + message);
69-
// }
56+
57+
58+
59+
60+
61+
62+
63+
7064
Random rand = new Random();
7165

66+
//Broadcast a message
7267
new Thread(new Runnable() {
7368
public void run() {
7469
try {
@@ -81,7 +76,10 @@ public void run() {
8176
}).start();
8277

8378

79+
80+
8481

82+
//Run a status collection procedure
8583
new Thread(new Runnable() {
8684
public void run() {
8785
try {
@@ -96,6 +94,10 @@ public void run() {
9694
}
9795
}
9896
}).start();
97+
98+
99+
100+
99101

100102
System.out.println(" main end ");
101103
//System.exit(0);

0 commit comments

Comments
 (0)
0