aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/juick/xmpp/s2s/XMPPComponent.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/juick/xmpp/s2s/XMPPComponent.java')
-rw-r--r--src/main/java/com/juick/xmpp/s2s/XMPPComponent.java14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/main/java/com/juick/xmpp/s2s/XMPPComponent.java b/src/main/java/com/juick/xmpp/s2s/XMPPComponent.java
index 50d2c1e4..4b523ab0 100644
--- a/src/main/java/com/juick/xmpp/s2s/XMPPComponent.java
+++ b/src/main/java/com/juick/xmpp/s2s/XMPPComponent.java
@@ -24,10 +24,12 @@ public class XMPPComponent implements ServletContextListener {
private static final Logger LOGGER = Logger.getLogger(XMPPComponent.class.getName());
- public static final ExecutorService executorService = Executors.newWorkStealingPool();
+ public static final ExecutorService executorService = Executors.newCachedThreadPool();
public static String HOSTNAME = null;
public static String STATSFILE = null;
+ public static String keystore;
+ public static String keystorePassword;
public static ConnectionRouter connRouter;
static final List<ConnectionIn> inConnections = Collections.synchronizedList(new ArrayList<>());
static final List<ConnectionOut> outConnections = Collections.synchronizedList(new ArrayList<>());
@@ -97,11 +99,11 @@ public class XMPPComponent implements ServletContextListener {
return null;
}
- public static void sendOut(Stanza s) {
+ public static void sendOut(Stanza s) throws Exception {
sendOut(s.to.Host, s.toString());
}
- public static void sendOut(String hostname, String xml) {
+ public static void sendOut(String hostname, String xml) throws Exception {
boolean haveAnyConn = false;
ConnectionOut connOut = null;
@@ -144,7 +146,7 @@ public class XMPPComponent implements ServletContextListener {
if (!haveAnyConn) {
ConnectionOut connectionOut = new ConnectionOut(hostname);
- connectionOut.parseStream();
+ XMPPComponent.executorService.submit(connectionOut);
}
}
@@ -159,6 +161,8 @@ public class XMPPComponent implements ServletContextListener {
HOSTNAME = conf.getProperty("hostname");
String componentName = conf.getProperty("componentname");
STATSFILE = conf.getProperty("statsfile");
+ keystore = conf.getProperty("keystore");
+ keystorePassword = conf.getProperty("keystore_password");
Class.forName("com.mysql.jdbc.Driver");
sql = DriverManager.getConnection("jdbc:mysql://localhost/juick?autoReconnect=true&user=" +
@@ -170,7 +174,7 @@ public class XMPPComponent implements ServletContextListener {
executorService.submit(connRouter);
executorService.submit(new ConnectionListener());
executorService.submit(new CleaningUp());
- } catch (IOException | ClassNotFoundException | SQLException e) {
+ } catch (Exception e) {
LOGGER.log(Level.SEVERE, "XMPPComponent error", e);
}
});