blob: a5631622d88e14df6e1939048b5f6a036ff0bf28 (
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
package server;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import models.Configuration;
import org.apache.log4j.BasicConfigurator;
import org.apache.log4j.Logger;
import fileserv.FileServer;
public class StartServer {
private static Logger log = Logger.getLogger(StartServer.class);
private static List<Thread> servers = new ArrayList<>();
public static void main(String[] args) {
//get going and show basic information in logfile
BasicConfigurator.configure();
log.info("****************************************************************");
log.info("******************* starting Application ***********************");
log.info("****************************************************************");
// get Configuration
try {
log.info("Loading configuration");
Configuration.load();
} catch (Exception e1) {
log.fatal("Could not load configuration", e1);
System.exit(1);
}
// Start file transfer server
if (!FileServer.instance().start()) {
log.error("Could not start internal file server.");
return;
}
// Start Server
Thread t;
t = new Thread(new BinaryListener());
servers.add(t);
t.start();
// Wait for servers
for (Thread wait : servers) {
boolean success = false;
while (!success) {
try {
wait.join();
success = true;
} catch (InterruptedException e) {
// Do nothing...
}
}
}
log.info(new Date() + " - all Servers shut down, exiting...\n");
}
}
|