1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2025-09-09 10:19:41 +02:00

Introduce CloseableUtil

This commit is contained in:
Florian Schmaus 2018-08-15 17:25:22 +02:00
parent 1136e8a2e9
commit a00aa726fe
19 changed files with 109 additions and 256 deletions

View file

@ -41,6 +41,7 @@ import org.jivesoftware.smack.packet.Stanza;
import org.jivesoftware.smack.packet.StanzaError;
import org.jivesoftware.smack.sasl.packet.SaslStreamElements.SASLFailure;
import org.jivesoftware.smack.sasl.packet.SaslStreamElements.Success;
import org.jivesoftware.smack.util.CloseableUtil;
import org.jivesoftware.smack.util.PacketParserUtils;
import org.igniterealtime.jbosh.AbstractBody;
@ -261,28 +262,13 @@ public class XMPPBOSHConnection extends AbstractXMPPConnection {
isFirstInitialization = false;
// Close down the readers and writers.
if (readerPipe != null) {
try {
readerPipe.close();
}
catch (Throwable ignore) { /* ignore */ }
reader = null;
}
if (reader != null) {
try {
reader.close();
}
catch (Throwable ignore) { /* ignore */ }
reader = null;
}
if (writer != null) {
try {
writer.close();
}
catch (Throwable ignore) { /* ignore */ }
writer = null;
}
CloseableUtil.maybeClose(readerPipe, LOGGER);
CloseableUtil.maybeClose(reader, LOGGER);
CloseableUtil.maybeClose(writer, LOGGER);
readerPipe = null;
reader = null;
writer = null;
readerConsumer = null;
}