aboutsummaryrefslogtreecommitdiff
path: root/juick-crosspost/src/main/java/com/juick/components
diff options
context:
space:
mode:
Diffstat (limited to 'juick-crosspost/src/main/java/com/juick/components')
-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()) {