mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-11-22 22:32:06 +01:00
Added unique identifier to each thread name (SMACK-51).
git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@6948 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
parent
2407d9e30f
commit
bf02dbe3da
3 changed files with 10 additions and 4 deletions
|
@ -77,7 +77,7 @@ class PacketReader {
|
||||||
parsePackets(this);
|
parsePackets(this);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
readerThread.setName("Smack Packet Reader");
|
readerThread.setName("Smack Packet Reader (" + connection.connectionCounterValue + ")");
|
||||||
readerThread.setDaemon(true);
|
readerThread.setDaemon(true);
|
||||||
|
|
||||||
listenerThread = new Thread() {
|
listenerThread = new Thread() {
|
||||||
|
@ -90,7 +90,7 @@ class PacketReader {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
listenerThread.setName("Smack Listener Processor");
|
listenerThread.setName("Smack Listener Processor (" + connection.connectionCounterValue + ")");
|
||||||
listenerThread.setDaemon(true);
|
listenerThread.setDaemon(true);
|
||||||
|
|
||||||
resetParser();
|
resetParser();
|
||||||
|
|
|
@ -92,7 +92,7 @@ class PacketWriter {
|
||||||
writePackets(this);
|
writePackets(this);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
writerThread.setName("Smack Packet Writer");
|
writerThread.setName("Smack Packet Writer (" + connection.connectionCounterValue + ")");
|
||||||
writerThread.setDaemon(true);
|
writerThread.setDaemon(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -222,7 +222,7 @@ class PacketWriter {
|
||||||
keepAliveThread = new Thread(target);
|
keepAliveThread = new Thread(target);
|
||||||
target.setThread(keepAliveThread);
|
target.setThread(keepAliveThread);
|
||||||
keepAliveThread.setDaemon(true);
|
keepAliveThread.setDaemon(true);
|
||||||
keepAliveThread.setName("Smack Keep Alive");
|
keepAliveThread.setName("Smack Keep Alive (" + connection.connectionCounterValue + ")");
|
||||||
keepAliveThread.start();
|
keepAliveThread.start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,6 +37,7 @@ import java.net.UnknownHostException;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.CopyOnWriteArraySet;
|
import java.util.concurrent.CopyOnWriteArraySet;
|
||||||
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a connection to a XMPP server. A simple use of this API might
|
* Creates a connection to a XMPP server. A simple use of this API might
|
||||||
|
@ -91,6 +92,10 @@ public class XMPPConnection {
|
||||||
private final static Set<ConnectionCreationListener> connectionEstablishedListeners =
|
private final static Set<ConnectionCreationListener> connectionEstablishedListeners =
|
||||||
new CopyOnWriteArraySet<ConnectionCreationListener>();
|
new CopyOnWriteArraySet<ConnectionCreationListener>();
|
||||||
|
|
||||||
|
// Counter to uniquely identify connections that are created. This is distinct from the
|
||||||
|
// connection ID, which is a value sent by the server once a connection is made.
|
||||||
|
private static AtomicInteger connectionCounter = new AtomicInteger(0);
|
||||||
|
|
||||||
static {
|
static {
|
||||||
// Use try block since we may not have permission to get a system
|
// Use try block since we may not have permission to get a system
|
||||||
// property (for example, when an applet).
|
// property (for example, when an applet).
|
||||||
|
@ -121,6 +126,7 @@ public class XMPPConnection {
|
||||||
*/
|
*/
|
||||||
String serviceName;
|
String serviceName;
|
||||||
|
|
||||||
|
int connectionCounterValue = connectionCounter.getAndIncrement();
|
||||||
String connectionID = null;
|
String connectionID = null;
|
||||||
private String user = null;
|
private String user = null;
|
||||||
private boolean connected = false;
|
private boolean connected = false;
|
||||||
|
|
Loading…
Reference in a new issue