aboutsummaryrefslogtreecommitdiff
path: root/juick-ws/src/main/java/com/juick/ws/components
diff options
context:
space:
mode:
Diffstat (limited to 'juick-ws/src/main/java/com/juick/ws/components')
-rw-r--r--juick-ws/src/main/java/com/juick/ws/components/XMPPComponent.java38
1 files changed, 14 insertions, 24 deletions
diff --git a/juick-ws/src/main/java/com/juick/ws/components/XMPPComponent.java b/juick-ws/src/main/java/com/juick/ws/components/XMPPComponent.java
index 6ce2482d..1db8c604 100644
--- a/juick-ws/src/main/java/com/juick/ws/components/XMPPComponent.java
+++ b/juick-ws/src/main/java/com/juick/ws/components/XMPPComponent.java
@@ -39,7 +39,7 @@ import java.util.logging.Logger;
* @author ugnich
*/
@Component
-public class XMPPComponent implements JuickComponent, DisposableBean, Stream.StreamListener,
+public class XMPPComponent implements DisposableBean, Stream.StreamListener,
Message.MessageListener, Iq.IqListener, Presence.PresenceListener {
private static final Logger logger = Logger.getLogger(XMPPComponent.class.getName());
@@ -82,18 +82,19 @@ public class XMPPComponent implements JuickComponent, DisposableBean, Stream.Str
childParsers.put(JuickMessage.XMLNS, new JuickMessage());
- Socket routerSocket = null;
- try {
- routerSocket = new Socket("localhost", componentPort);
- setRouter(new StreamComponent(new JID("s2s"), routerSocket.getInputStream(), routerSocket.getOutputStream(), env.getProperty("xmpp_password")));
- getRouter().addChildParser(new JuickMessage());
- getRouter().addListener((Stream.StreamListener) this);
- getRouter().addListener((Message.MessageListener) this);
- getRouter().addListener((Iq.IqListener) this);
-
- } catch (IOException e) {
- logger.log(Level.SEVERE, "router error", e);
- }
+ executorService.submit(() -> {
+ try {
+ Socket routerSocket = new Socket("localhost", componentPort);
+ router = new StreamComponent(new JID("s2s"), routerSocket.getInputStream(), routerSocket.getOutputStream(), env.getProperty("xmpp_password"));
+ router.addChildParser(new JuickMessage());
+ router.addListener((Stream.StreamListener) this);
+ router.addListener((Message.MessageListener) this);
+ router.addListener((Iq.IqListener) this);
+ router.startParsing();
+ } catch (IOException e) {
+ logger.log(Level.SEVERE, "router error", e);
+ }
+ });
executorService.submit(() -> {
final ServerSocket listener = new ServerSocket(s2sPort);
logger.info("s2s listener ready");
@@ -231,13 +232,6 @@ public class XMPPComponent implements JuickComponent, DisposableBean, Stream.Str
}
}
- @Async
- @Override
- public void init() {
- getRouter().startParsing();
- }
-
-
@Override
public void destroy() {
@@ -457,10 +451,6 @@ public class XMPPComponent implements JuickComponent, DisposableBean, Stream.Str
return router;
}
- public void setRouter(StreamComponent router) {
- this.router = router;
- }
-
public List<ConnectionIn> getInConnections() {
return inConnections;
}