From 948b46c07da5a697b611df7a6223818f29f717fd Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Thu, 2 Nov 2017 14:11:34 +0300 Subject: api: another try to reconnect ws --- juick-api/src/main/java/com/juick/api/ApiServer.java | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'juick-api/src/main/java/com/juick') diff --git a/juick-api/src/main/java/com/juick/api/ApiServer.java b/juick-api/src/main/java/com/juick/api/ApiServer.java index d7862952..d5324319 100644 --- a/juick-api/src/main/java/com/juick/api/ApiServer.java +++ b/juick-api/src/main/java/com/juick/api/ApiServer.java @@ -22,13 +22,8 @@ import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Value; -import org.springframework.beans.factory.support.DefaultListableBeanFactory; import org.springframework.context.ApplicationListener; -import org.springframework.context.support.AbstractApplicationContext; -import org.springframework.web.context.WebApplicationContext; -import org.springframework.web.context.support.WebApplicationContextUtils; import org.springframework.web.socket.client.WebSocketConnectionManager; -import org.springframework.web.socket.client.standard.StandardWebSocketClient; import rocks.xmpp.addr.Jid; import rocks.xmpp.core.XmppException; import rocks.xmpp.core.session.Extension; @@ -41,7 +36,6 @@ import rocks.xmpp.extensions.oob.model.x.OobX; import javax.annotation.Nonnull; import javax.annotation.PostConstruct; import javax.inject.Inject; -import javax.servlet.ServletContext; import java.net.URI; import java.net.URISyntaxException; @@ -64,7 +58,7 @@ public class ApiServer implements ApplicationListener, AutoCl @Value("${xmpp_disabled:false}") private boolean isXmppDisabled; @Inject - private ServletContext servletContext; + private WebSocketConnectionManager webSocketConnectionManager; @PostConstruct public void init() { @@ -123,7 +117,7 @@ public class ApiServer implements ApplicationListener, AutoCl @Override public void onApplicationEvent(@Nonnull DisconnectedEvent event) { logger.info("reloading app..."); - WebApplicationContext context = WebApplicationContextUtils.getWebApplicationContext(servletContext); - ((AbstractApplicationContext) context).refresh(); + webSocketConnectionManager.stop(); + webSocketConnectionManager.start(); } } -- cgit v1.2.3