diff options
Diffstat (limited to 'juick-xmpp-ft/src/main/java')
-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"); + } } |