mirror of
https://github.com/vanitasvitae/Smack.git
synced 2025-09-10 17:49:38 +02:00
Add AbstractXMPPConnection.toString()
This commit is contained in:
parent
bfb3f5cd95
commit
7c3f4b7129
4 changed files with 17 additions and 11 deletions
|
@ -1303,8 +1303,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
|||
|
||||
@Override
|
||||
protected void finalize() throws Throwable {
|
||||
LOGGER.fine("finalizing XMPPConnection ( " + getConnectionCounter()
|
||||
+ "): Shutting down executor services");
|
||||
LOGGER.fine("finalizing " + this + ": Shutting down executor services");
|
||||
try {
|
||||
// It's usually not a good idea to rely on finalize. But this is the easiest way to
|
||||
// avoid the "Smack Listener Processor" leaking. The thread(s) of the executor have a
|
||||
|
@ -1569,6 +1568,13 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
|||
return parsingExceptionCallback;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final String toString() {
|
||||
FullJid localEndpoint = getUser();
|
||||
String localEndpointString = (localEndpoint == null ? "not-authenticated" : localEndpoint.toString());
|
||||
return getClass().getSimpleName() + '[' + localEndpointString + "] (" + getConnectionCounter() + ')';
|
||||
}
|
||||
|
||||
protected final void asyncGo(Runnable runnable) {
|
||||
cachedExecutorService.execute(runnable);
|
||||
}
|
||||
|
|
|
@ -78,10 +78,10 @@ public abstract class AbstractDebugger implements SmackDebugger {
|
|||
connListener = new ConnectionListener() {
|
||||
public void connected(XMPPConnection connection) {
|
||||
log("XMPPConnection connected ("
|
||||
+ connection.getConnectionCounter() + ")");
|
||||
+ connection + ")");
|
||||
}
|
||||
public void authenticated(XMPPConnection connection, boolean resumed) {
|
||||
String logString = "XMPPConnection authenticated (" + connection.getConnectionCounter() + ")";
|
||||
String logString = "XMPPConnection authenticated (" + connection + ")";
|
||||
if (resumed) {
|
||||
logString += " and resumed";
|
||||
}
|
||||
|
@ -90,32 +90,32 @@ public abstract class AbstractDebugger implements SmackDebugger {
|
|||
public void connectionClosed() {
|
||||
log(
|
||||
"XMPPConnection closed (" +
|
||||
connection.getConnectionCounter() +
|
||||
connection +
|
||||
")");
|
||||
}
|
||||
|
||||
public void connectionClosedOnError(Exception e) {
|
||||
log(
|
||||
"XMPPConnection closed due to an exception (" +
|
||||
connection.getConnectionCounter() +
|
||||
connection +
|
||||
")", e);
|
||||
}
|
||||
public void reconnectionFailed(Exception e) {
|
||||
log(
|
||||
"Reconnection failed due to an exception (" +
|
||||
connection.getConnectionCounter() +
|
||||
connection +
|
||||
")", e);
|
||||
}
|
||||
public void reconnectionSuccessful() {
|
||||
log(
|
||||
"XMPPConnection reconnected (" +
|
||||
connection.getConnectionCounter() +
|
||||
connection +
|
||||
")");
|
||||
}
|
||||
public void reconnectingIn(int seconds) {
|
||||
log(
|
||||
"XMPPConnection (" +
|
||||
connection.getConnectionCounter() +
|
||||
connection +
|
||||
") will reconnect in " + seconds);
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue