From 4679da47ffedf2a0f29c324880fa537fe9447f39 Mon Sep 17 00:00:00 2001 From: Alexander Alexeev Date: Fri, 18 Nov 2016 03:47:00 +0700 Subject: correct closing babble components implemented --- juick-ws/src/main/java/com/juick/ws/XMPPConnection.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'juick-ws') diff --git a/juick-ws/src/main/java/com/juick/ws/XMPPConnection.java b/juick-ws/src/main/java/com/juick/ws/XMPPConnection.java index c6ac5b50..fb510306 100644 --- a/juick-ws/src/main/java/com/juick/ws/XMPPConnection.java +++ b/juick-ws/src/main/java/com/juick/ws/XMPPConnection.java @@ -29,7 +29,7 @@ import java.util.stream.Collectors; /** * @author ugnich */ -public class XMPPConnection implements InitializingBean { +public class XMPPConnection implements InitializingBean, DisposableBean { private static final Logger logger = LoggerFactory.getLogger(XMPPConnection.class); private final JdbcTemplate jdbc; @@ -90,6 +90,14 @@ public class XMPPConnection implements InitializingBean { } } + @Override + public void destroy() throws Exception { + if (xmpp != null) + xmpp.close(); + + logger.info("XmppSession on WS destroyed"); + } + MessageSerializer messageSerializer = new MessageSerializer(); private void onJuickPM(final int uid_to, final com.juick.Message jmsg) { -- cgit v1.2.3