aboutsummaryrefslogtreecommitdiff
path: root/juick-notifications/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-notifications/src
parentc260c0c4a0a8d84a7ef442eb40d5a63e9d5326dc (diff)
correct closing babble components implemented
Diffstat (limited to 'juick-notifications/src')
-rw-r--r--juick-notifications/src/main/java/com/juick/components/Notifications.java11
1 files changed, 10 insertions, 1 deletions
diff --git a/juick-notifications/src/main/java/com/juick/components/Notifications.java b/juick-notifications/src/main/java/com/juick/components/Notifications.java
index 21e85c37..ea428a2d 100644
--- a/juick-notifications/src/main/java/com/juick/components/Notifications.java
+++ b/juick-notifications/src/main/java/com/juick/components/Notifications.java
@@ -38,6 +38,7 @@ import org.apache.http.util.TextUtils;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.core.env.Environment;
@@ -56,7 +57,7 @@ import java.util.List;
/**
* @author Ugnich Anton
*/
-public class Notifications implements InitializingBean {
+public class Notifications implements InitializingBean, DisposableBean {
private static Logger logger = LoggerFactory.getLogger(Notifications.class);
private final RestTemplate rest;
@@ -209,6 +210,14 @@ public class Notifications implements InitializingBean {
}
}
+ @Override
+ public void destroy() throws Exception {
+ if (xmpp != null)
+ xmpp.close();
+
+ logger.info("ExternalComponent on notifications destroyed");
+ }
+
String getWnsAccessToken() throws IOException, IllegalStateException {
if (TextUtils.isEmpty(wns_application_sip)) {
throw new IllegalStateException("'wns_application_sip' is not initialized");