aboutsummaryrefslogtreecommitdiff
path: root/juick-xmpp/src/main/java/com
diff options
context:
space:
mode:
authorGravatar Alexander Alexeev2016-11-18 13:48:45 +0700
committerGravatar Vitaly Takmazov2016-11-18 10:07:20 +0300
commit7128df991d737d23ee77f89bfe79ec4b79a362df (patch)
treee02cdb213fb52f2215919f38d0b3244d50a3e94b /juick-xmpp/src/main/java/com
parent5af964e05a79e64f02ebcfb3e1b19f109e32deaf (diff)
one way for inititialization and finalization: using constructor's initialization or method init() and AutoCloseable inteface and method close()
Diffstat (limited to 'juick-xmpp/src/main/java/com')
-rw-r--r--juick-xmpp/src/main/java/com/juick/components/XMPPServer.java9
1 files changed, 2 insertions, 7 deletions
diff --git a/juick-xmpp/src/main/java/com/juick/components/XMPPServer.java b/juick-xmpp/src/main/java/com/juick/components/XMPPServer.java
index cb5172d6..a2f593ee 100644
--- a/juick-xmpp/src/main/java/com/juick/components/XMPPServer.java
+++ b/juick-xmpp/src/main/java/com/juick/components/XMPPServer.java
@@ -1,7 +1,6 @@
package com.juick.components;
import com.juick.components.s2s.*;
-import com.juick.util.ThreadHelper;
import com.juick.xmpp.JID;
import com.juick.xmpp.Stanza;
import com.juick.xmpp.StanzaChild;
@@ -10,7 +9,6 @@ import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.math.NumberUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.DisposableBean;
import org.springframework.core.env.Environment;
import org.springframework.jdbc.core.JdbcTemplate;
import org.xmlpull.v1.XmlPullParserException;
@@ -29,7 +27,7 @@ import java.util.concurrent.ExecutorService;
/**
* @author ugnich
*/
-public class XMPPServer implements DisposableBean {
+public class XMPPServer implements AutoCloseable {
private static final Logger logger = LoggerFactory.getLogger(XMPPServer.class);
public ExecutorService service;
@@ -99,7 +97,7 @@ public class XMPPServer implements DisposableBean {
}
@Override
- public void destroy() throws Exception {
+ public void close() throws Exception {
synchronized (getOutConnections()) {
for (Iterator<ConnectionOut> i = getOutConnections().iterator(); i.hasNext(); ) {
ConnectionOut c = i.next();
@@ -115,9 +113,6 @@ public class XMPPServer implements DisposableBean {
i.remove();
}
}
-
- ThreadHelper.shutdownAndAwaitTermination(service);
-
logger.info("Xmpp server destroyed");
}