-
Notifications
You must be signed in to change notification settings - Fork 2
/
Main.java
41 lines (37 loc) · 908 Bytes
/
Main.java
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
import cs6378.node.MetaServer;
import cs6378.node.NetClient;
import cs6378.node.NetServer;
public class Main {
public static void main(String[] args) {
new Thread(new Runnable() {
@Override
public void run() {
MetaServer mServer = new MetaServer();
mServer.init();
}
}).start();
int[] servers = new int [] {1, 2, 3, 4, 5};
for(int i = 0; i < servers.length; i++) {
final int j = servers[i];
new Thread(new Runnable() {
@Override
public void run() {
NetServer mServer = new NetServer(j + "");
mServer.init();
}
}).start();
}
int[] clients = new int [] {6, 7, 8};
for(int i = 0; i < clients.length; i++) {
final int j = clients[i];
new Thread(new Runnable() {
@Override
public void run() {
NetClient client = new NetClient(j+"");
client.init();
client.request_critical_section();
}
}).start();
}
}
}