blob: 16741dd9eb53f3d1ac2dbb8907de16a28264fd02 (
plain) (
blame)
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
|
//RemoteServer.java
package derms.Replica3pkg;
import javax.xml.ws.Endpoint;
import java.util.*;
public class RemoteServer {
public RemoteServer() {
try {
Map<String, Integer> UDPPorts = new HashMap<>();
UDPPorts.put("MTL", 4000);
UDPPorts.put("QUE", 5000);
UDPPorts.put("SHE", 6000);
String[] serverNames = {"MTL", "QUE", "SHE"};
int i = 0;
for (String serverName : serverNames) {
int UDPPort = UDPPorts.get(serverName);
Server server = new Server();
server.initServer(serverName, UDPPort, UDPPorts);
int port = 8080 + i;
String url = "http://localhost:" + port + "/DERMS/" + serverName;
Endpoint.publish(url, server);
i++;
System.out.println(serverName + " Server ready and waiting ...");
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
|