aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/juick/xmpp/s2s/XMPPComponent.java
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2016-05-07 19:57:10 +0300
committerGravatar Vitaly Takmazov2016-05-07 19:57:10 +0300
commitb1d5d5801e90ef0d4e282a78543f1435b8b7d223 (patch)
tree70dcd3a4a67c4a15847b3c17357897709f2334ee /src/main/java/com/juick/xmpp/s2s/XMPPComponent.java
parentf2a2660e753fa11478fd3edadfdff9c000b22cc9 (diff)
STARTTLS
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);
}
});