1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-11-22 03:52:06 +01:00

Use Asyn.go() to create and start reader thread

in XMPPTCPConnection.
This commit is contained in:
Florian Schmaus 2015-01-15 16:12:41 +01:00
parent ed84b4a8b3
commit 04d47b2dda

View file

@ -69,6 +69,7 @@ import org.jivesoftware.smack.tcp.sm.packet.StreamManagement.StreamManagementFea
import org.jivesoftware.smack.tcp.sm.predicates.Predicate; import org.jivesoftware.smack.tcp.sm.predicates.Predicate;
import org.jivesoftware.smack.tcp.sm.provider.ParseStreamManagement; import org.jivesoftware.smack.tcp.sm.provider.ParseStreamManagement;
import org.jivesoftware.smack.util.ArrayBlockingQueueWithShutdown; import org.jivesoftware.smack.util.ArrayBlockingQueueWithShutdown;
import org.jivesoftware.smack.util.Async;
import org.jivesoftware.smack.util.PacketParserUtils; import org.jivesoftware.smack.util.PacketParserUtils;
import org.jivesoftware.smack.util.StringUtils; import org.jivesoftware.smack.util.StringUtils;
import org.jivesoftware.smack.util.TLSUtils; import org.jivesoftware.smack.util.TLSUtils;
@ -910,8 +911,6 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
protected class PacketReader { protected class PacketReader {
private Thread readerThread;
XmlPullParser parser; XmlPullParser parser;
private volatile boolean done; private volatile boolean done;
@ -925,14 +924,11 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
void init() throws SmackException { void init() throws SmackException {
done = false; done = false;
readerThread = new Thread() { Async.go(new Runnable() {
public void run() { public void run() {
parsePackets(); parsePackets();
} }
}; }, "Smack Packet Reader (" + getConnectionCounter() + ")");
readerThread.setName("Smack Packet Reader (" + getConnectionCounter() + ")");
readerThread.setDaemon(true);
readerThread.start();
} }
/** /**