aboutsummaryrefslogtreecommitdiff
path: root/juick-ws/src/main/java/com
diff options
context:
space:
mode:
Diffstat (limited to 'juick-ws/src/main/java/com')
-rw-r--r--juick-ws/src/main/java/com/juick/ws/components/XMPPComponent.java38
-rw-r--r--juick-ws/src/main/java/com/juick/ws/configuration/WebsocketConfiguration.java1
-rw-r--r--juick-ws/src/main/java/com/juick/ws/s2s/JuickBot.java2
3 files changed, 15 insertions, 26 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;
}
diff --git a/juick-ws/src/main/java/com/juick/ws/configuration/WebsocketConfiguration.java b/juick-ws/src/main/java/com/juick/ws/configuration/WebsocketConfiguration.java
index 495a3c91..3b75028e 100644
--- a/juick-ws/src/main/java/com/juick/ws/configuration/WebsocketConfiguration.java
+++ b/juick-ws/src/main/java/com/juick/ws/configuration/WebsocketConfiguration.java
@@ -103,7 +103,6 @@ public class WebsocketConfiguration extends WebMvcConfigurationSupport implement
@Bean
public XMPPComponent xmpp() {
XMPPComponent xmpp = new XMPPComponent(env);
- xmpp.init();
return xmpp;
}
@Bean
diff --git a/juick-ws/src/main/java/com/juick/ws/s2s/JuickBot.java b/juick-ws/src/main/java/com/juick/ws/s2s/JuickBot.java
index f5500242..14c63b59 100644
--- a/juick-ws/src/main/java/com/juick/ws/s2s/JuickBot.java
+++ b/juick-ws/src/main/java/com/juick/ws/s2s/JuickBot.java
@@ -218,7 +218,7 @@ public class JuickBot {
xmpp.sendOut(reply);
}
- return true;
+ return false;
}
private static Pattern regexPM = Pattern.compile("^\\@(\\S+)\\s+([\\s\\S]+)$");