-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCliente2.java
More file actions
44 lines (34 loc) · 1.07 KB
/
Copy pathCliente2.java
File metadata and controls
44 lines (34 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import java.net.MalformedURLException;
import java.rmi.Naming;
import java.rmi.NotBoundException;
import java.rmi.RemoteException;
import java.util.Stack;
public class Cliente2 {
public static void main (String args[]) {
try {
LojaRemota loja1= (LojaRemota)Naming.lookup("rmi://localhost:2126/loja");
LojaRemota loja2= (LojaRemota)Naming.lookup("rmi://localhost:2127/loja");
try {
Stack<String> prodLoja1= loja1.getAllProducts();
Stack<String> prodLoja2= loja2.getAllProducts();
System.out.println("produtos Loja 1:");
for(int i=0; i<prodLoja1.size() ;i++){
System.out.println(prodLoja1.get(i));
}
System.out.println("produtos Loja 2:");
for(int x=0; x<prodLoja2.size() ;x++){
System.out.println(prodLoja2.get(x));
}
} catch (Excecao e2) {
// TODO Auto-generated catch block
System.out.println(e2.getMessage());
}
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (RemoteException e) {
e.printStackTrace();
} catch (NotBoundException e) {
e.printStackTrace();
}
}
}