1 package org.openslx.imagemaster;
3 import java.net.InetAddress;
4 import java.net.SocketException;
5 import java.security.NoSuchAlgorithmException;
6 import java.util.ArrayList;
9 import org.apache.logging.log4j.LogManager;
10 import org.apache.logging.log4j.Logger;
11 import org.apache.logging.log4j.core.config.Configurator;
12 import org.apache.logging.log4j.core.config.DefaultConfiguration;
13 import org.apache.thrift.transport.TTransportException;
26 private static Logger
log = LogManager.getLogger(
App.class );
28 private static final String
NAME =
"Master-Server";
30 private static List<Thread>
servers =
new ArrayList<>();
32 public static void main( String[] args )
throws TTransportException, NoSuchAlgorithmException, SocketException
35 if (
org.apache.logging.log4j.core.Logger.class.cast( LogManager.getRootLogger() ).getAppenders().isEmpty() ) {
36 Configurator.initialize(
new DefaultConfiguration() );
39 AppUtil.logHeader( log,
App.
NAME,
App.class.getPackage().getImplementationVersion() );
40 AppUtil.logProperty( log,
"rpc.version", Long.toString( Version.VERSION ) );
51 t =
new Thread(
new NetworkHandler( 1333, InetAddress.getLoopbackAddress() ) );
61 }
catch ( Exception e ) {
62 log.warn(
"No TLS available", e );
68 t =
new Thread(
new HttpListener(
"127.0.0.1", 8090 ),
"JSON-HTTP" );
71 }
catch ( Exception e ) {
72 log.warn(
"No JSON-HTTP available", e );
78 for ( Thread wait : servers ) {
79 boolean success =
false;
84 }
catch ( InterruptedException e ) {
85 if ( wait.isInterrupted() || !wait.isAlive() )
91 log.info(
"All Servers shut down, exiting..." );
static int getThriftPortSsl()
The main class that starts all the services.
static List< Thread > servers
static int getThriftPortPlain()
Class to hold global constants and properties from 'config/global.properties'.
static void main(String[] args)
The network listener that will receive incoming UDP packets, try to process them, and then send a rep...