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

Remove deprecated reconnection callbacks in ConnectionListener

Fixes SMACK-776.
This commit is contained in:
Florian Schmaus 2018-04-07 21:15:20 +02:00
parent 0a99291d59
commit f11134dc4c
5 changed files with 0 additions and 91 deletions

View file

@ -45,21 +45,4 @@ public class AbstractConnectionListener implements ConnectionListener {
// do nothing // do nothing
} }
@Deprecated
@Override
public void reconnectingIn(int seconds) {
// do nothing
}
@Deprecated
@Override
public void reconnectionFailed(Exception e) {
// do nothing
}
@Deprecated
@Override
public void reconnectionSuccessful() {
// do nothing
}
} }

View file

@ -1279,25 +1279,6 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
} }
} }
/**
* Sends a notification indicating that the connection was reconnected successfully.
*/
// TODO: Remove in Smack 4.3
@Deprecated
protected void notifyReconnection() {
// Notify connection listeners of the reconnection.
for (ConnectionListener listener : connectionListeners) {
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 stanza filter with a listener. * A wrapper class to associate a stanza filter with a listener.
*/ */

View file

@ -61,41 +61,4 @@ public interface ConnectionListener {
*/ */
void connectionClosedOnError(Exception e); void connectionClosedOnError(Exception e);
/**
* The connection has reconnected successfully to the server. Connections will
* reconnect to the server when the previous socket connection was abruptly closed.
* @deprecated use {@link #connected(XMPPConnection)} or {@link #authenticated(XMPPConnection, boolean)} instead.
*/
// TODO: Remove in Smack 4.3
@Deprecated
void reconnectionSuccessful();
// The next two methods *must* only be invoked by ReconnectionManager
/**
* The connection will retry to reconnect in the specified number of seconds.
* <p>
* Note: This method is only called if {@link ReconnectionManager#isAutomaticReconnectEnabled()} returns true, i.e.
* only when the reconnection manager is enabled for the connection.
* </p>
*
* @param seconds remaining seconds before attempting a reconnection.
*/
// TODO: Remove in Smack 4.3
@Deprecated
void reconnectingIn(int seconds);
/**
* An attempt to connect to the server has failed. The connection will keep trying reconnecting to the server in a
* moment.
* <p>
* Note: This method is only called if {@link ReconnectionManager#isAutomaticReconnectEnabled()} returns true, i.e.
* only when the reconnection manager is enabled for the connection.
* </p>
*
* @param e the exception that caused the reconnection to fail.
*/
// TODO: Remove in Smack 4.3
@Deprecated
void reconnectionFailed(Exception e);
} }

View file

@ -262,9 +262,6 @@ public final class ReconnectionManager {
for (ReconnectionListener listener : reconnectionListeners) { for (ReconnectionListener listener : reconnectionListeners) {
listener.reconnectingIn(remainingSeconds); listener.reconnectingIn(remainingSeconds);
} }
for (ConnectionListener listener : connection.connectionListeners) {
listener.reconnectingIn(remainingSeconds);
}
} }
catch (InterruptedException e) { catch (InterruptedException e) {
LOGGER.log(Level.FINE, "Reconnection Thread was interrupted, aborting reconnection mechanism", e); LOGGER.log(Level.FINE, "Reconnection Thread was interrupted, aborting reconnection mechanism", e);
@ -276,9 +273,6 @@ public final class ReconnectionManager {
for (ReconnectionListener listener : reconnectionListeners) { for (ReconnectionListener listener : reconnectionListeners) {
listener.reconnectingIn(0); listener.reconnectingIn(0);
} }
for (ConnectionListener listener : connection.connectionListeners) {
listener.reconnectingIn(0);
}
if (!isReconnectionPossible(connection)) { if (!isReconnectionPossible(connection)) {
return; return;
@ -304,9 +298,6 @@ public final class ReconnectionManager {
for (ReconnectionListener listener : reconnectionListeners) { for (ReconnectionListener listener : reconnectionListeners) {
listener.reconnectionFailed(e); listener.reconnectionFailed(e);
} }
for (ConnectionListener listener : connection.connectionListeners) {
listener.reconnectionFailed(e);
}
// Failed to reconnect, try again. // Failed to reconnect, try again.
continue; continue;
} catch (InterruptedException e) { } catch (InterruptedException e) {

View file

@ -53,8 +53,6 @@ import org.jxmpp.stringprep.XmppStringprepException;
*/ */
public class DummyConnection extends AbstractXMPPConnection { public class DummyConnection extends AbstractXMPPConnection {
private boolean reconnect = false;
private final BlockingQueue<TopLevelStreamElement> queue = new LinkedBlockingQueue<TopLevelStreamElement>(); private final BlockingQueue<TopLevelStreamElement> queue = new LinkedBlockingQueue<TopLevelStreamElement>();
public static ConnectionConfiguration.Builder<?,?> getDummyConfigurationBuilder() { public static ConnectionConfiguration.Builder<?,?> getDummyConfigurationBuilder() {
@ -88,16 +86,10 @@ public class DummyConnection extends AbstractXMPPConnection {
user = getUserJid(); user = getUserJid();
} }
@SuppressWarnings("deprecation")
@Override @Override
protected void connectInternal() { protected void connectInternal() {
connected = true; connected = true;
streamId = "dummy-" + new Random(new Date().getTime()).nextInt(); streamId = "dummy-" + new Random(new Date().getTime()).nextInt();
// TODO: Remove in Smack 4.3, and likely the suppression of the deprecation warning.
if (reconnect) {
notifyReconnection();
}
} }
@Override @Override
@ -106,7 +98,6 @@ public class DummyConnection extends AbstractXMPPConnection {
authenticated = false; authenticated = false;
callConnectionClosedListener(); callConnectionClosedListener();
reconnect = true;
} }
@Override @Override