aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/juick/xmpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/juick/xmpp')
-rw-r--r--src/main/java/com/juick/xmpp/s2s/ConnectionListener.java7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/main/java/com/juick/xmpp/s2s/ConnectionListener.java b/src/main/java/com/juick/xmpp/s2s/ConnectionListener.java
index f29b8d09..314be116 100644
--- a/src/main/java/com/juick/xmpp/s2s/ConnectionListener.java
+++ b/src/main/java/com/juick/xmpp/s2s/ConnectionListener.java
@@ -3,6 +3,8 @@ 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;
/**
*
@@ -10,6 +12,8 @@ import java.net.Socket;
*/
public class ConnectionListener implements Runnable {
+ ExecutorService executorService = Executors.newCachedThreadPool();
+
@Override
public void run() {
try {
@@ -18,8 +22,7 @@ public class ConnectionListener implements Runnable {
Socket sock = listener.accept();
ConnectionIn conn = new ConnectionIn(sock);
XMPPComponent.addConnectionIn(conn);
- Thread t = new Thread(conn);
- t.start();
+ executorService.submit(conn);
}
} catch (IOException e) {
System.out.println("IOException on socket listen: " + e.toString());