package server; import java.util.ArrayList; import java.util.Date; import java.util.List; import org.apache.log4j.BasicConfigurator; import org.apache.log4j.Logger; import server.BinaryListener; public class startServer { /** * @param args */ private static Logger log = Logger.getLogger( startServer.class ); private static List servers = new ArrayList<>(); public static void main(String[] args) { BasicConfigurator.configure(); log.info( new Date() + " - starting Application\n" ); Thread t; t = new Thread(new BinaryListener()); servers.add(t); t.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( new Date()+" - all Servers shut down, exiting...\n" ); } }