diff options
author | Alexander Alexeev | 2016-11-18 13:48:45 +0700 |
---|---|---|
committer | Vitaly Takmazov | 2016-11-18 10:07:20 +0300 |
commit | 7128df991d737d23ee77f89bfe79ec4b79a362df (patch) | |
tree | e02cdb213fb52f2215919f38d0b3244d50a3e94b /juick-ws/src/main/java/com/juick/ws/XMPPConnection.java | |
parent | 5af964e05a79e64f02ebcfb3e1b19f109e32deaf (diff) |
one way for inititialization and finalization: using constructor's initialization or method init() and AutoCloseable inteface and method close()
Diffstat (limited to 'juick-ws/src/main/java/com/juick/ws/XMPPConnection.java')
-rw-r--r-- | juick-ws/src/main/java/com/juick/ws/XMPPConnection.java | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/juick-ws/src/main/java/com/juick/ws/XMPPConnection.java b/juick-ws/src/main/java/com/juick/ws/XMPPConnection.java index fb510306..30dad3f3 100644 --- a/juick-ws/src/main/java/com/juick/ws/XMPPConnection.java +++ b/juick-ws/src/main/java/com/juick/ws/XMPPConnection.java @@ -4,12 +4,9 @@ import com.juick.User; import com.juick.json.MessageSerializer; import com.juick.server.MessagesQueries; import com.juick.server.SubscriptionsQueries; -import com.juick.util.ThreadHelper; import org.apache.commons.lang3.math.NumberUtils; 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.jdbc.core.JdbcTemplate; import org.springframework.util.Assert; @@ -23,13 +20,12 @@ import rocks.xmpp.extensions.component.accept.ExternalComponent; import java.io.IOException; import java.util.List; -import java.util.concurrent.ExecutorService; import java.util.stream.Collectors; /** * @author ugnich */ -public class XMPPConnection implements InitializingBean, DisposableBean { +public class XMPPConnection implements AutoCloseable { private static final Logger logger = LoggerFactory.getLogger(XMPPConnection.class); private final JdbcTemplate jdbc; @@ -56,10 +52,7 @@ public class XMPPConnection implements InitializingBean, DisposableBean { wsJid = env.getProperty("ws_jid", "ws.juick.local"); ms = new MessageSerializer(); - } - @Override - public void afterPropertiesSet() { XmppSessionConfiguration configuration = XmppSessionConfiguration.builder() .extensions(Extension.of(com.juick.Message.class)) .build(); @@ -91,7 +84,7 @@ public class XMPPConnection implements InitializingBean, DisposableBean { } @Override - public void destroy() throws Exception { + public void close() throws Exception { if (xmpp != null) xmpp.close(); |