mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-12-25 22:07:56 +01:00
Move notifyReconnection in AbstractXMPPConnection
This commit is contained in:
parent
82eb9b18dd
commit
67c0a7089b
4 changed files with 19 additions and 24 deletions
|
@ -479,9 +479,7 @@ public class XMPPBOSHConnection extends AbstractXMPPConnection {
|
|||
if (wasAuthenticated) {
|
||||
login();
|
||||
}
|
||||
for (ConnectionListener listener : getConnectionListeners()) {
|
||||
listener.reconnectionSuccessful();
|
||||
}
|
||||
notifyReconnection();
|
||||
}
|
||||
catch (Exception e) {
|
||||
for (ConnectionListener listener : getConnectionListeners()) {
|
||||
|
|
|
@ -1073,6 +1073,23 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends a notification indicating that the connection was reconnected successfully.
|
||||
*/
|
||||
protected void notifyReconnection() {
|
||||
// Notify connection listeners of the reconnection.
|
||||
for (ConnectionListener listener : getConnectionListeners()) {
|
||||
try {
|
||||
listener.reconnectionSuccessful();
|
||||
}
|
||||
catch (Exception e) {
|
||||
// Catch and print any exception so we can recover
|
||||
// from a faulty listener
|
||||
LOGGER.log(Level.WARNING, "notifyReconnection()", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A wrapper class to associate a packet filter with a listener.
|
||||
*/
|
||||
|
|
|
@ -81,9 +81,7 @@ public class DummyConnection extends AbstractXMPPConnection {
|
|||
connectionID = "dummy-" + new Random(new Date().getTime()).nextInt();
|
||||
|
||||
if (reconnect) {
|
||||
for (ConnectionListener listener : getConnectionListeners()) {
|
||||
listener.reconnectionSuccessful();
|
||||
}
|
||||
notifyReconnection();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,6 @@ import org.jivesoftware.smack.AbstractXMPPConnection;
|
|||
import org.jivesoftware.smack.ConnectionConfiguration;
|
||||
import org.jivesoftware.smack.ConnectionConfiguration.SecurityMode;
|
||||
import org.jivesoftware.smack.ConnectionCreationListener;
|
||||
import org.jivesoftware.smack.ConnectionListener;
|
||||
import org.jivesoftware.smack.PacketListener;
|
||||
import org.jivesoftware.smack.SmackConfiguration;
|
||||
import org.jivesoftware.smack.SmackException;
|
||||
|
@ -843,23 +842,6 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
|
|||
callConnectionClosedOnErrorListener(e);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends a notification indicating that the connection was reconnected successfully.
|
||||
*/
|
||||
private void notifyReconnection() {
|
||||
// Notify connection listeners of the reconnection.
|
||||
for (ConnectionListener listener : getConnectionListeners()) {
|
||||
try {
|
||||
listener.reconnectionSuccessful();
|
||||
}
|
||||
catch (Exception e) {
|
||||
// Catch and print any exception so we can recover
|
||||
// from a faulty listener
|
||||
LOGGER.log(Level.WARNING, "notifyReconnection()", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* For unit testing purposes
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue