blob: 9a5fd151b9edede7ba90929ceb368d4ec25b5782 (
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
|
package org.openslx.imagemaster;
import java.util.ArrayList;
import java.util.List;
import org.apache.log4j.Logger;
import org.openslx.imagemaster.server.MasterFtpServer;
import org.openslx.imagemaster.thrift.server.BinaryListener;
/**
* Hello world!
*
*/
public class App
{
private static Logger log = Logger.getLogger( App.class );
private static List<Thread> servers = new ArrayList<>();
public static void main( String[] args )
{
// Init logging
log.info( "Starting Application" );
// Create binary listener
Thread t;
t = new Thread(new BinaryListener(), "BinaryListener");
servers.add(t);
t.start();
// Create Ftp Server
Thread f;
f = new Thread(new MasterFtpServer(2221, "admin", "admin", "/home/nils/ftp"), "FtpServer");
servers.add(f);
f.start();
// Run more servers
// ...
// Wait for all servers to die
for (Thread wait : servers) {
boolean success = false;
while (!success) {
try {
wait.join();
success = true;
} catch ( InterruptedException e ) {
// Do nothing...
}
}
}
log.info( "All Servers shut down, exiting..." );
}
}
|