diff options
author | Vitaly Takmazov | 2017-11-02 14:11:34 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2017-11-02 14:11:34 +0300 |
commit | 948b46c07da5a697b611df7a6223818f29f717fd (patch) | |
tree | 4dcce2210c72fd68e7488dcb6962d4314f5cd284 | |
parent | 483a4ac3df2900608b61bd007ae8d0b75287cd3a (diff) |
api: another try to reconnect ws
-rw-r--r-- | juick-api/src/main/java/com/juick/api/ApiServer.java | 12 |
1 files changed, 3 insertions, 9 deletions
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<DisconnectedEvent>, 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<DisconnectedEvent>, AutoCl @Override public void onApplicationEvent(@Nonnull DisconnectedEvent event) { logger.info("reloading app..."); - WebApplicationContext context = WebApplicationContextUtils.getWebApplicationContext(servletContext); - ((AbstractApplicationContext) context).refresh(); + webSocketConnectionManager.stop(); + webSocketConnectionManager.start(); } } |