diff options
author | Vitaly Takmazov | 2016-02-03 13:54:12 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2016-02-03 13:54:12 +0300 |
commit | e80e13c27e6f06c52a3dc8602cd1f02abdfc3180 (patch) | |
tree | a309a04f63bd0e4eefae4b0583e88352f1f0e802 /src/main/java/com/juick/xmpp/s2s | |
parent | 380018da475ff41d3375e7f2bea0a192a4d9b178 (diff) |
WIP
Diffstat (limited to 'src/main/java/com/juick/xmpp/s2s')
-rw-r--r-- | src/main/java/com/juick/xmpp/s2s/ConnectionListener.java | 8 | ||||
-rw-r--r-- | src/main/java/com/juick/xmpp/s2s/S2SComponent.java | 11 |
2 files changed, 12 insertions, 7 deletions
diff --git a/src/main/java/com/juick/xmpp/s2s/ConnectionListener.java b/src/main/java/com/juick/xmpp/s2s/ConnectionListener.java index 28ff48f9..320df347 100644 --- a/src/main/java/com/juick/xmpp/s2s/ConnectionListener.java +++ b/src/main/java/com/juick/xmpp/s2s/ConnectionListener.java @@ -1,5 +1,6 @@ package com.juick.xmpp.s2s; +import com.juick.JuickApplication; import com.juick.xmpp.JuickBot; import com.juick.xmpp.Stream; @@ -23,10 +24,11 @@ public class ConnectionListener implements Runnable { JuickBot bot; Stream xmpp; - public ConnectionListener(ExecutorService executorService, JuickBot bot, Stream xmpp) { - this.executorService = executorService; + public ConnectionListener(JuickApplication app, JuickBot bot) { + this.executorService = app.getExecutorService(); + this.xmpp = app.getRouter(); this.bot = bot; - this.xmpp = xmpp; + } @Override diff --git a/src/main/java/com/juick/xmpp/s2s/S2SComponent.java b/src/main/java/com/juick/xmpp/s2s/S2SComponent.java index dcb547fb..b7155643 100644 --- a/src/main/java/com/juick/xmpp/s2s/S2SComponent.java +++ b/src/main/java/com/juick/xmpp/s2s/S2SComponent.java @@ -1,5 +1,6 @@ package com.juick.xmpp.s2s; +import com.juick.JuickApplication; import com.juick.JuickComponent; import com.juick.User; import com.juick.server.MessagesQueries; @@ -33,6 +34,7 @@ public class S2SComponent implements JuickComponent { static final List<ConnectionOut> outConnections = Collections.synchronizedList(new ArrayList<>()); static final List<CacheEntry> outCache = Collections.synchronizedList(new ArrayList<>()); JdbcTemplate sql; + JuickBot bot; final public static HashMap<String, StanzaChild> childParsers = new HashMap<>(); public static void addConnectionIn(ConnectionIn c) { @@ -147,14 +149,15 @@ public class S2SComponent implements JuickComponent { } } - public S2SComponent(JdbcTemplate sql, ExecutorService executorService, Properties conf) { + public S2SComponent(JuickApplication application, Properties conf) { LOGGER.info("component initialized"); HOSTNAME = conf.getProperty("hostname"); componentName = conf.getProperty("componentname"); STATSFILE = conf.getProperty("statsfile"); - this.sql = sql; - this.executorService = executorService; - executorService.submit(new ConnectionListener(executorService)); + this.sql = application.getSql(); + this.executorService = application.getExecutorService(); + this.bot = new JuickBot(application, this); + executorService.submit(new ConnectionListener(application, bot)); executorService.submit(new CleaningUp()); } @Override |