-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWebServer.java
More file actions
executable file
·49 lines (37 loc) · 1.11 KB
/
WebServer.java
File metadata and controls
executable file
·49 lines (37 loc) · 1.11 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
45
46
47
48
49
import java.io.IOException;
import org.apache.log4j.Logger;
public class WebServer {
private static Logger log = Logger.getLogger(WebServer.class);
public static String MyIP;
public static int MyPort;
public static boolean frontend = false;
public static void main(String[] args) {
if (args[0].equals("-f")) {
MyPort = Integer.parseInt(args[1]);
log.info("Starting frontend...initializing from " + args[2] + ":" + args[3]);
SSM ssm = SSM.getInstance();
ssm.initFrontend(args[2], Integer.parseInt(args[3]));
frontend = true;
} else {
MyIP = args[0];
MyPort = Integer.parseInt(args[1]);
log.info("Starting physical server " + MyIP + ":" + MyPort);
SSM ssm = SSM.getInstance();
if (args.length > 2) {
log.info("Joining network, connecting to " + args[2] + ":"
+ args[3]);
ssm.initFromServer(args[2], Integer.parseInt(args[3]));
} else {
log.info("First server, Initializing system");
ssm.initSystem();
}
}
Thread t = null;
try {
t = new HttpCoreRequestListener(MyPort);
} catch (IOException e) {
}
t.setDaemon(false);
t.start();
}
}