From 7cbf108b84682fb17af15f528df3f0bd952fc58d Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Wed, 6 Jul 2016 19:47:18 +0300 Subject: refactoring --- .../java/com/juick/xmpp/s2s/XMPPComponent.java | 41 +++++++++++----------- 1 file changed, 21 insertions(+), 20 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/juick/xmpp/s2s/XMPPComponent.java b/src/main/java/com/juick/xmpp/s2s/XMPPComponent.java index 5cdce82a..8ebdb76a 100644 --- a/src/main/java/com/juick/xmpp/s2s/XMPPComponent.java +++ b/src/main/java/com/juick/xmpp/s2s/XMPPComponent.java @@ -170,23 +170,23 @@ public class XMPPComponent implements ServletContextListener { public void contextInitialized(ServletContextEvent sce) { LOGGER.info("component initialized"); - xmppService.submit(() -> { - Properties conf = new Properties(); - try { - conf.load(sce.getServletContext().getResourceAsStream("/WEB-INF/juick.conf")); - HOSTNAME = conf.getProperty("hostname"); - String componentName = conf.getProperty("componentname"); - STATSFILE = conf.getProperty("statsfile"); - keystore = conf.getProperty("keystore"); - keystorePassword = conf.getProperty("keystore_password"); - brokenSSLhosts = Arrays.asList(conf.getProperty("broken_ssl_hosts", "").split(",")); - DriverManagerDataSource dataSource = new DriverManagerDataSource(); - dataSource.setDriverClassName(conf.getProperty("datasource_driver", "com.mysql.jdbc.Driver")); - dataSource.setUrl(conf.getProperty("datasource_url")); - sql = new JdbcTemplate(dataSource); + Properties conf = new Properties(); + try { + conf.load(sce.getServletContext().getResourceAsStream("/WEB-INF/juick.conf")); + HOSTNAME = conf.getProperty("hostname"); + String componentName = conf.getProperty("componentname"); + STATSFILE = conf.getProperty("statsfile"); + keystore = conf.getProperty("keystore"); + keystorePassword = conf.getProperty("keystore_password"); + brokenSSLhosts = Arrays.asList(conf.getProperty("broken_ssl_hosts", "").split(",")); + DriverManagerDataSource dataSource = new DriverManagerDataSource(); + dataSource.setDriverClassName(conf.getProperty("datasource_driver", "com.mysql.jdbc.Driver")); + dataSource.setUrl(conf.getProperty("datasource_url")); + sql = new JdbcTemplate(dataSource); - childParsers.put(JuickMessage.XMLNS, new JuickMessage()); - executorService.submit(() -> connRouter = new ConnectionRouter(this, componentName, conf.getProperty("xmpp_password"))); + childParsers.put(JuickMessage.XMLNS, new JuickMessage()); + xmppService.submit(() -> { + connRouter = new ConnectionRouter(this, componentName, conf.getProperty("xmpp_password")); executorService.submit(new CleaningUp(this)); final ServerSocket listener = new ServerSocket(5269); LOGGER.info("s2s listener ready"); @@ -200,10 +200,11 @@ public class XMPPComponent implements ServletContextListener { LOGGER.log(Level.SEVERE, "s2s error", e); } } - } catch (Exception e) { - LOGGER.log(Level.SEVERE, "XMPPComponent error", e); - } - }); + }); + + } catch (Exception e) { + LOGGER.log(Level.SEVERE, "XMPPComponent error", e); + } } -- cgit v1.2.3