1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2025-09-09 00:59:39 +02:00

Smack 4.2.2

-----BEGIN PGP SIGNATURE-----
 
 iQGTBAABCgB9FiEEl3UFnzoh3OFr5PuuIjmn6PWFIFIFAloZnf5fFIAAAAAALgAo
 aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDk3
 NzUwNTlGM0EyMURDRTE2QkU0RkJBRTIyMzlBN0U4RjU4NTIwNTIACgkQIjmn6PWF
 IFLcIQgAsTLRI3sWIZDPRuI5YaU/y6beqqzMp5cQgk/9+9DHGBoziLEU1spkvBs2
 Yvlwu3NtHSJsI+ibzYLEFRnzEwuW07vXw7R5J+kRSZrsE40z1HCQRwUIXDkPgghe
 MuL6vT6OV+kLqKb33YLSBuT2fj2pzVE6mRmMsnFekay/weEqOGUZaY9Hd5lJ31/9
 33fQC0FQfKULQ5t7PbdfX4dDDNWn0n6v+KjvjaskHI0oA+vqPWxPkj8gNXWW8b72
 tVV4h5uXQ0ziK3oED79+GH+DSiET9N2PmsZ7woXiFy5H8KbcQDVe5Pazf+Iq2VQ+
 Vi6Vxikr6Ak+v2Xkt+e3x9E6mZDI1w==
 =CVqq
 -----END PGP SIGNATURE-----

Merge tag '4.2.2'

Smack 4.2.2
This commit is contained in:
Florian Schmaus 2017-11-25 18:45:32 +01:00
commit 76a6b9f2a1
16 changed files with 235 additions and 81 deletions

View file

@ -17,12 +17,15 @@
package org.jivesoftware.smackx.debugger.slf4j;
import org.jivesoftware.smack.ConnectionListener;
import org.jivesoftware.smack.AbstractConnectionListener;
import org.jivesoftware.smack.ReconnectionListener;
import org.jivesoftware.smack.XMPPConnection;
import org.slf4j.Logger;
class SLF4JLoggingConnectionListener implements ConnectionListener {
// TODO: The suppression of deprecated API can be removed in Smack 4.3.
@SuppressWarnings("deprecation")
class SLF4JLoggingConnectionListener extends AbstractConnectionListener implements ReconnectionListener {
private final XMPPConnection connection;
private final Logger logger;
@ -56,11 +59,6 @@ class SLF4JLoggingConnectionListener implements ConnectionListener {
logger.debug("({}) Reconnection failed due to an exception: {}", connection.hashCode(), e);
}
@Override
public void reconnectionSuccessful() {
logger.debug("({}) Connection reconnected", connection.hashCode());
}
@Override
public void reconnectingIn(int seconds) {
logger.debug("({}) Connection will reconnect in {}", connection.hashCode(), seconds);

View file

@ -21,6 +21,8 @@ import java.io.Reader;
import java.io.Writer;
import java.util.concurrent.atomic.AtomicBoolean;
import org.jivesoftware.smack.AbstractXMPPConnection;
import org.jivesoftware.smack.ReconnectionManager;
import org.jivesoftware.smack.SmackConfiguration;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.debugger.SmackDebugger;
@ -40,6 +42,8 @@ import org.slf4j.LoggerFactory;
*/
public class SLF4JSmackDebugger extends SmackDebugger {
private static final java.util.logging.Logger LOGGER = java.util.logging.Logger.getLogger(SLF4JSmackDebugger.class.getName());
public static final String LOGGER_NAME = "SMACK";
private static final Logger logger = LoggerFactory.getLogger(LOGGER_NAME);
public static final AtomicBoolean printInterpreted = new AtomicBoolean(true);
@ -70,7 +74,17 @@ public class SLF4JSmackDebugger extends SmackDebugger {
this.writer.addWriterListener(slf4JRawXmlListener);
this.reader = new ObservableReader(Validate.notNull(reader));
this.reader.addReaderListener(slf4JRawXmlListener);
this.connection.addConnectionListener(new SLF4JLoggingConnectionListener(connection, logger));
final SLF4JLoggingConnectionListener loggingConnectionListener = new SLF4JLoggingConnectionListener(connection, logger);
this.connection.addConnectionListener(loggingConnectionListener);
if (connection instanceof AbstractXMPPConnection) {
AbstractXMPPConnection abstractXmppConnection = (AbstractXMPPConnection) connection;
ReconnectionManager.getInstanceFor(abstractXmppConnection).addReconnectionListener(loggingConnectionListener);
} else {
LOGGER.info("The connection instance " + connection
+ " is not an instance of AbstractXMPPConnection, thus we can not install the ReconnectionListener");
}
}
@Override