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