@DoNotImplement public interface MqttClientAutoReconnect extends MqttClientDisconnectedListener
The initial delay will be doubled for every unsuccessful connect attempt. The actual delay will be capped at the maximum delay. Additionally a random delay of +-25% will be added.
Modifier and Type | Field and Description |
---|---|
static long |
DEFAULT_MAX_DELAY_S
The default maximum delay in seconds the client will wait before it tries to reconnect.
|
static long |
DEFAULT_START_DELAY_S
The default initial delay in seconds the client will wait before it tries to reconnect.
|
Modifier and Type | Method and Description |
---|---|
static @NotNull MqttClientAutoReconnectBuilder |
builder()
Creates a builder for an automatic reconnect strategy.
|
@NotNull MqttClientAutoReconnectBuilder |
extend()
Creates a builder for extending this automatic reconnect strategy.
|
long |
getInitialDelay(@NotNull TimeUnit timeUnit)
Returns the initial delay the client will wait before it tries to reconnect.
|
long |
getMaxDelay(@NotNull TimeUnit timeUnit)
Returns the maximum delay the client will wait before it tries to reconnect.
|
onDisconnected
static final long DEFAULT_START_DELAY_S
static final long DEFAULT_MAX_DELAY_S
@NotNull static @NotNull MqttClientAutoReconnectBuilder builder()
long getInitialDelay(@NotNull @NotNull TimeUnit timeUnit)
This delay will be doubled for every unsuccessful connect attempt.
timeUnit
- the time unit of the returned initial delay.long getMaxDelay(@NotNull @NotNull TimeUnit timeUnit)
timeUnit
- the time unit of the returned maximum delay.@NotNull @NotNull MqttClientAutoReconnectBuilder extend()