@Override public void connectionLost(Throwable cause) { LOGGER.warn("connection is Lost"); if (!userDisconnect && autoReconnect) { // If we have been connected longer than the connectionStabilityTime then // restart the reconnect logic from minimum value before scheduling reconnect. if ((lastConnackTime + (connectionStabilityTime * MILLIS_IN_ONE_SECOND)) < getSystemTimeMs()) { resetReconnect(); } if (scheduleReconnect()) { connectionState = MqttManagerConnectionState.Reconnecting; } else { connectionState = MqttManagerConnectionState.Disconnected; } } else { connectionState = MqttManagerConnectionState.Disconnected; } userConnectionCallback(cause); }
mqttMessageQueue.clear(); resetReconnect(); userDisconnect = false;
@Override public void connectionLost(Throwable cause) { LOGGER.warn("connection is Lost"); if (!userDisconnect && autoReconnect) { // If we have been connected longer than the connectionStabilityTime then // restart the reconnect logic from minimum value before scheduling reconnect. if ((lastConnackTime + (connectionStabilityTime * MILLIS_IN_ONE_SECOND)) < getSystemTimeMs()) { resetReconnect(); } if (scheduleReconnect()) { connectionState = MqttManagerConnectionState.Reconnecting; } else { connectionState = MqttManagerConnectionState.Disconnected; } } else { connectionState = MqttManagerConnectionState.Disconnected; } userConnectionCallback(cause); }
mqttMessageQueue.clear(); resetReconnect(); userDisconnect = false;