aboutsummaryrefslogtreecommitdiff
path: root/juick-crosspost/src
diff options
context:
space:
mode:
authorGravatar Alexander Alexeev2016-11-18 03:47:00 +0700
committerGravatar Vitaly Takmazov2016-11-18 09:24:54 +0300
commit4679da47ffedf2a0f29c324880fa537fe9447f39 (patch)
treea40e86f6033492a977447b9696437cb894d24f9d /juick-crosspost/src
parentc260c0c4a0a8d84a7ef442eb40d5a63e9d5326dc (diff)
correct closing babble components implemented
Diffstat (limited to 'juick-crosspost/src')
-rw-r--r--juick-crosspost/src/main/java/com/juick/components/Crosspost.java11
1 files changed, 10 insertions, 1 deletions
diff --git a/juick-crosspost/src/main/java/com/juick/components/Crosspost.java b/juick-crosspost/src/main/java/com/juick/components/Crosspost.java
index f14749eb..8b56f86d 100644
--- a/juick-crosspost/src/main/java/com/juick/components/Crosspost.java
+++ b/juick-crosspost/src/main/java/com/juick/components/Crosspost.java
@@ -23,6 +23,7 @@ import org.apache.commons.lang3.math.NumberUtils;
import org.apache.commons.lang3.tuple.Pair;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.core.env.Environment;
import org.springframework.util.Assert;
@@ -45,7 +46,7 @@ import java.util.UUID;
/**
* @author Ugnich Anton
*/
-public class Crosspost implements InitializingBean {
+public class Crosspost implements InitializingBean, DisposableBean {
final static String TWITTERURL = "https://api.twitter.com/1.1/statuses/update.json";
final static String FBURL = "https://graph.facebook.com/me/feed";
final static String VKURL = "https://api.vk.com/method/wall.post";
@@ -110,6 +111,14 @@ public class Crosspost implements InitializingBean {
}
}
+ @Override
+ public void destroy() throws Exception {
+ if (xmpp != null)
+ xmpp.close();
+
+ logger.info("XmppSession on crosspost destroyed");
+ }
+
public boolean facebookPost(final com.juick.Message jmsg) {
String token = crosspostService.getFacebookToken(jmsg.getUser().getUid()).orElse("");
if (token.isEmpty()) {