use of CommandHandler.CommandProcess in project SmartCity-Market by TechnionYP5777.
the class Main method main.
public static void main(String[] args) {
if (!parseArguments(args))
return;
/* Setting log properties */
PropertyConfigurator.configure("../log4j.properties");
log.setLevel(verbosity);
CommandProcess commandProcess = new CommandProcess();
ThreadPooledServer server = null;
try {
server = new ThreadPooledServer(port, numOfThreads, commandProcess, serverIP);
} catch (UnknownHostException e1) {
log.fatal("Server IP address leads to unknown host, server won't start.");
return;
}
SQLDatabaseConnection connection = new SQLDatabaseConnection();
log.info("Disconnect from all clients");
try {
connection.logoutAllUsers();
connection.close();
} catch (CriticalError e1) {
log.fatal("Disconnect failed");
return;
}
log.info("Starting Server.");
new Thread(server).start();
try {
Thread.sleep(1000 * timeout);
} catch (InterruptedException e) {
/* Get interrupt to stop server */
log.info("Server Got interrupted.");
}
log.info("Stopping server.");
server.stop();
}
Aggregations