Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 0fbca6d

Browse filesBrowse files
author
LENOVO-PC\Vasilis
committed
distributed trial 3
1 parent c330bb2 commit 0fbca6d
Copy full SHA for 0fbca6d

File tree

3 files changed

+7
-15
lines changed
Filter options

3 files changed

+7
-15
lines changed

‎Assignment3/src/assignment3/node/IComponent.java

Copy file name to clipboardExpand all lines: Assignment3/src/assignment3/node/IComponent.java
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@ public interface IComponent extends Remote {
1515
public void receiveChangeRoot(Message message, Link link) throws RemoteException ;
1616
public void setEntities(IComponent[] entities) throws RemoteException ;
1717
public void wakeUp() throws RemoteException;
18-
public void isAlive() throws RemoteException;
18+
public IComponent[] getEntities() throws RemoteException;
1919

2020
}

‎Assignment3/src/assignment3/node/Node.java

Copy file name to clipboardExpand all lines: Assignment3/src/assignment3/node/Node.java
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
public class Node extends UnicastRemoteObject implements IComponent {
1818

19-
private IComponent[] nodes;
19+
private IComponent[] nodes = null;
2020

2121
private int id;
2222
private NodeState state;
@@ -518,7 +518,7 @@ public void setEntities(IComponent[] entities) throws RemoteException {
518518
}
519519

520520
@Override
521-
public void isAlive() throws RemoteException{
522-
System.out.println("Node "+ id+ " is up");
521+
public IComponent[] getEntities() throws RemoteException{
522+
return nodes;
523523
}
524524
}

‎Assignment3/src/assignment3/server/Client1.java

Copy file name to clipboardExpand all lines: Assignment3/src/assignment3/server/Client1.java
+3-11Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -143,18 +143,10 @@ public static void setRegistry() throws NotBoundException, NumberFormatException
143143
//Scanner scan = new Scanner(System.in);
144144
//scan.nextLine();
145145
for (int i=0; i<numProc; i++){
146-
success = false;
147-
while(!success){
148-
try{
149-
RMI_IDS[localIDS.get(i)].isAlive();
150-
success = true;
151-
}
152-
catch(RemoteException e){
153-
System.err.println("Client 2 not initialized its processes yet");
154-
//e.printStackTrace();
155-
}
146+
while(RMI_IDS[i].getEntities()==null){
147+
System.err.println("Node "+i+" not initialized yet");
156148
}
157-
}
149+
}
158150
myThreads[0].start();
159151
}
160152
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.