Class AbstractReconnectStrategy

Direct Known Subclasses:

@NonNullByDefault public abstract class AbstractReconnectStrategy extends Object
Implement this class to provide a strategy for (re)establishing a lost broker connection.
David Graeff - Initial contribution
  • Field Details

  • Constructor Details

    • AbstractReconnectStrategy

      public AbstractReconnectStrategy()
  • Method Details

    • setBrokerConnection

      public void setBrokerConnection(MqttBrokerConnection mqttBrokerConnectionImpl)
      Will be called by .
      mqttBrokerConnectionImpl - The broker connection
    • getBrokerConnection

      public @Nullable MqttBrokerConnection getBrokerConnection()
      Return the brokerConnection object that this reconnect policy is assigned to.
    • isReconnecting

      public abstract boolean isReconnecting()
      Return true if your implementation is trying to establish a connection, false otherwise.
    • lostConnection

      public abstract void lostConnection()
      The MqttConnectionObserver will call this method if a broker connection has been lost or couldn't be established. Your implementation should start trying to reestablish a connection.
    • connectionEstablished

      public abstract void connectionEstablished()
      The MqttConnectionObserver will call this method if a broker connection has been successfully established. Your implementation should stop reconnection attempts and release resources.
    • start

      public abstract void start()
      Start the reconnect strategy handling.
    • stop

      public abstract void stop()
      Stop the reconnect strategy handling.

      It must be possible to restart a reconnect strategy again after it has been stopped.