fixed exponential backup logic

revert-dabc3590
ayyoob 9 years ago
parent 2d6caafa0c
commit 4001dbf887

@ -263,11 +263,11 @@ public class MQTTAdapterListener implements MqttCallback, Runnable {
@Override @Override
public void run() { public void run() {
int connectionDuration = MQTTEventAdapterConstants.initialReconnectDuration;
while (!connectionSucceeded) { while (!connectionSucceeded) {
try { try {
MQTTEventAdapterConstants.initialReconnectDuration = MQTTEventAdapterConstants.initialReconnectDuration connectionDuration = connectionDuration * MQTTEventAdapterConstants.reconnectionProgressionFactor;
* MQTTEventAdapterConstants.reconnectionProgressionFactor; Thread.sleep(connectionDuration);
Thread.sleep(MQTTEventAdapterConstants.initialReconnectDuration);
startListener(); startListener();
connectionSucceeded = true; connectionSucceeded = true;
log.info("MQTT Connection successful"); log.info("MQTT Connection successful");

@ -48,7 +48,7 @@ public class MQTTEventAdapterConstants {
public static final int ADAPTER_CONF_DEFAULT_KEEP_ALIVE = 60000; public static final int ADAPTER_CONF_DEFAULT_KEEP_ALIVE = 60000;
public static int initialReconnectDuration = 2000; public static int initialReconnectDuration = 2000;
public static final int reconnectionProgressionFactor = 4; public static final int reconnectionProgressionFactor = 2;
public static final String EMPTY_STRING = ""; public static final String EMPTY_STRING = "";
public static final String GRANT_TYPE = "urn:ietf:params:oauth:grant-type:jwt-bearer refresh_token"; public static final String GRANT_TYPE = "urn:ietf:params:oauth:grant-type:jwt-bearer refresh_token";

@ -203,10 +203,10 @@ public class XMPPAdapterListener implements Runnable {
@Override @Override
public void run() { public void run() {
while (!connectionSucceeded) { while (!connectionSucceeded) {
int connectionDuration = XMPPEventAdapterConstants.initialReconnectDuration;
try { try {
XMPPEventAdapterConstants.initialReconnectDuration = XMPPEventAdapterConstants.initialReconnectDuration connectionDuration = connectionDuration * XMPPEventAdapterConstants.reconnectionProgressionFactor;
* XMPPEventAdapterConstants.reconnectionProgressionFactor; Thread.sleep(connectionDuration);
Thread.sleep(XMPPEventAdapterConstants.initialReconnectDuration);
startListener(); startListener();
connectionSucceeded = true; connectionSucceeded = true;
log.info("XMPP Connection successful"); log.info("XMPP Connection successful");

@ -50,7 +50,7 @@ public class XMPPEventAdapterConstants {
public static final int DEFAULT_TIMEOUT_INTERVAL = 5000; public static final int DEFAULT_TIMEOUT_INTERVAL = 5000;
public static int initialReconnectDuration = 2000; public static int initialReconnectDuration = 2000;
public static final int reconnectionProgressionFactor = 4; public static final int reconnectionProgressionFactor = 2;
public static final String DEFAULT = "default"; public static final String DEFAULT = "default";

Loading…
Cancel
Save