XMPPTCPConnection log when reader/writer threads start and exit

This commit is contained in:
Florian Schmaus 2019-03-25 13:06:12 +01:00
parent 007a04c4fe
commit 5d46e281fc
1 changed files with 10 additions and 2 deletions

View File

@ -1063,6 +1063,8 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
protected class PacketReader { protected class PacketReader {
private final String threadName = "Smack Reader (" + getConnectionCounter() + ')';
XmlPullParser parser; XmlPullParser parser;
private volatile boolean done; private volatile boolean done;
@ -1077,13 +1079,15 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
Async.go(new Runnable() { Async.go(new Runnable() {
@Override @Override
public void run() { public void run() {
LOGGER.finer(threadName + " start");
try { try {
parsePackets(); parsePackets();
} finally { } finally {
LOGGER.finer(threadName + " exit");
XMPPTCPConnection.this.readerWriterSemaphore.release(); XMPPTCPConnection.this.readerWriterSemaphore.release();
} }
} }
}, "Smack Reader (" + getConnectionCounter() + ")"); }, threadName);
} }
/** /**
@ -1336,6 +1340,8 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
protected class PacketWriter { protected class PacketWriter {
public static final int QUEUE_SIZE = XMPPTCPConnection.QUEUE_SIZE; public static final int QUEUE_SIZE = XMPPTCPConnection.QUEUE_SIZE;
private final String threadName = "Smack Writer (" + getConnectionCounter() + ')';
private final ArrayBlockingQueueWithShutdown<Element> queue = new ArrayBlockingQueueWithShutdown<>( private final ArrayBlockingQueueWithShutdown<Element> queue = new ArrayBlockingQueueWithShutdown<>(
QUEUE_SIZE, true); QUEUE_SIZE, true);
@ -1381,13 +1387,15 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
Async.go(new Runnable() { Async.go(new Runnable() {
@Override @Override
public void run() { public void run() {
LOGGER.finer(threadName + " start");
try { try {
writePackets(); writePackets();
} finally { } finally {
LOGGER.finer(threadName + " exit");
XMPPTCPConnection.this.readerWriterSemaphore.release(); XMPPTCPConnection.this.readerWriterSemaphore.release();
} }
} }
}, "Smack Writer (" + getConnectionCounter() + ")"); }, threadName);
} }
private boolean done() { private boolean done() {