org.jivesoftware.smack.ReconnectionManager Java Examples

The following examples show how to use org.jivesoftware.smack.ReconnectionManager. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SLF4JSmackDebugger.java    From Smack with Apache License 2.0 6 votes vote down vote up
/**
 * Create new SLF4J Smack Debugger instance.
 * @param connection Smack connection to debug
 */
SLF4JSmackDebugger(XMPPConnection connection) {
    super(connection);
    this.writer = new ObservableWriter(writer);
    this.writer.addWriterListener(slf4JRawXmlListener);
    this.reader = new ObservableReader(Validate.notNull(reader));
    this.reader.addReaderListener(slf4JRawXmlListener);

    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");
    }
}
 
Example #2
Source File: ReconnectPanel.java    From Spark with Apache License 2.0 4 votes vote down vote up
/**
 * Construct the RetryPanel.
 */
public ReconnectPanel() {
    setLayout(new GridBagLayout());

    // Init Components
    pane = new JEditorPane();
    pane.setBackground(Color.white);
    pane.setEditorKit(new HTMLEditorKit());
    pane.setEditable(false);

    _icon = new JLabel(SparkRes.getImageIcon(SparkRes.SMALL_CHECK));

    layoutComponents();

    setBackground(Color.white);

    _icon.setText(Res.getString("button.reconnect2"));

    SparkManager.getConnection().addConnectionListener(this);

    ReconnectionManager.getInstanceFor(SparkManager.getConnection()).addReconnectionListener(this);
}