diff options
author | Alexander Alexeev | 2016-11-18 03:47:00 +0700 |
---|---|---|
committer | Vitaly Takmazov | 2016-11-18 09:24:54 +0300 |
commit | 4679da47ffedf2a0f29c324880fa537fe9447f39 (patch) | |
tree | a40e86f6033492a977447b9696437cb894d24f9d /juick-xmpp-ft/src/main | |
parent | c260c0c4a0a8d84a7ef442eb40d5a63e9d5326dc (diff) |
correct closing babble components implemented
Diffstat (limited to 'juick-xmpp-ft/src/main')
-rw-r--r-- | juick-xmpp-ft/src/main/java/com/juick/components/XMPPFTServer.java | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/juick-xmpp-ft/src/main/java/com/juick/components/XMPPFTServer.java b/juick-xmpp-ft/src/main/java/com/juick/components/XMPPFTServer.java index 93baba70..d411179c 100644 --- a/juick-xmpp-ft/src/main/java/com/juick/components/XMPPFTServer.java +++ b/juick-xmpp-ft/src/main/java/com/juick/components/XMPPFTServer.java @@ -26,11 +26,13 @@ import java.util.concurrent.ExecutionException; /** * Created by vitalyster on 11.11.2016. */ -public class XMPPFTServer { +public class XMPPFTServer implements AutoCloseable { private static final Logger logger = LoggerFactory.getLogger(XMPPFTServer.class); + private ExternalComponent component; + public XMPPFTServer(Environment env) { - ExternalComponent component = ExternalComponent.create(env.getProperty("component_name", "files"), + component = ExternalComponent.create(env.getProperty("component_name", "files"), env.getProperty("component_password", "secret"), env.getProperty("component_host", "localhost"), NumberUtils.toInt(env.getProperty("component_port", "5347"), 5347)); String tmpDir = env.getProperty("upload_tmp_dir", "/tmp"); @@ -80,4 +82,12 @@ public class XMPPFTServer { logger.error("ft initialization error", e); } } + + @Override + public void close() throws Exception { + if (component != null) + component.close(); + + logger.info("ExternalComponent on xmpp-ft destroyed"); + } } |