package com.juick.xmpp.s2s; import java.io.IOException; import java.net.ServerSocket; import java.net.Socket; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.logging.Logger; /** * * @author ugnich */ public class ConnectionListener implements Runnable { private static final Logger LOGGER = Logger.getLogger(ConnectionListener.class.getName()); ExecutorService executorService = Executors.newCachedThreadPool(); @Override public void run() { try { ServerSocket listener = new ServerSocket(5269); while (true) { Socket sock = listener.accept(); ConnectionIn conn = new ConnectionIn(sock); XMPPComponent.addConnectionIn(conn); executorService.submit(conn); } } catch (IOException e) { LOGGER.info("IOException on socket listen: " + e.toString()); } } }