aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2016-01-26 21:03:36 +0300
committerGravatar Vitaly Takmazov2016-01-26 21:03:36 +0300
commit72abd7c5f31f2db7606ef8ca6b38e09a899de51d (patch)
tree02f6e80b14c3bc35e602aed99693cf5ccad8e2f6 /src/main/java
parentb9d7b0f0379d0e824bf23a98421a32b585a48ed7 (diff)
CachedThreadPool for s2s
Diffstat (limited to 'src/main/java')
-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 f29b8d095..314be116c 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());