From b1d5d5801e90ef0d4e282a78543f1435b8b7d223 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Sat, 7 May 2016 19:57:10 +0300 Subject: STARTTLS --- src/main/java/com/juick/xmpp/s2s/XMPPComponent.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'src/main/java/com/juick/xmpp/s2s/XMPPComponent.java') 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 inConnections = Collections.synchronizedList(new ArrayList<>()); static final List 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); } }); -- cgit v1.2.3