From 5863621118700b538ab01ba3a74a0b013e1334c7 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Mon, 26 Mar 2018 10:13:32 +0300 Subject: server: reuse single router connection --- .../main/java/com/juick/server/ServerManager.java | 64 ++-------------------- .../main/java/com/juick/server/XMPPConnection.java | 4 ++ 2 files changed, 8 insertions(+), 60 deletions(-) (limited to 'juick-server/src') diff --git a/juick-server/src/main/java/com/juick/server/ServerManager.java b/juick-server/src/main/java/com/juick/server/ServerManager.java index efa4b3f0..22b78905 100644 --- a/juick-server/src/main/java/com/juick/server/ServerManager.java +++ b/juick-server/src/main/java/com/juick/server/ServerManager.java @@ -23,7 +23,6 @@ import com.juick.server.component.MessageEvent; import com.juick.service.MessagesService; import com.juick.service.SubscriptionService; import org.apache.commons.lang3.StringUtils; -import org.apache.commons.lang3.math.NumberUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Value; @@ -31,21 +30,11 @@ import org.springframework.context.ApplicationListener; import org.springframework.stereotype.Component; import org.springframework.web.socket.TextMessage; import rocks.xmpp.addr.Jid; -import rocks.xmpp.core.XmppException; -import rocks.xmpp.core.session.Extension; -import rocks.xmpp.core.session.XmppSessionConfiguration; import rocks.xmpp.core.stanza.model.Message; -import rocks.xmpp.extensions.component.accept.ExternalComponent; import rocks.xmpp.extensions.oob.model.x.OobX; -import rocks.xmpp.util.XmppUtils; -import javax.annotation.PostConstruct; import javax.inject.Inject; -import javax.xml.bind.JAXBException; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamWriter; import java.io.IOException; -import java.io.StringWriter; import java.net.URI; import java.net.URISyntaxException; import java.util.List; @@ -55,21 +44,9 @@ import java.util.stream.Collectors; * @author Ugnich Anton */ @Component -public class ServerManager implements AutoCloseable, ApplicationListener { +public class ServerManager implements ApplicationListener { private static Logger logger = LoggerFactory.getLogger(ServerManager.class); - private ExternalComponent xmpp; - - @Value("${xmpp_host:localhost}") - private String xmppHost; - @Value("${xmpp_password:secret}") - private String xmppPassword; - @Value("${ws_jid:ws.localhost}") - private String xmppJid; - @Value("${xmpp_port:5347}") - private int xmppPort; - @Value("${xmpp_disabled:false}") - private boolean isXmppDisabled; @Inject private ObjectMapper jsonMapper; @Inject @@ -80,44 +57,11 @@ public class ServerManager implements AutoCloseable, ApplicationListener