Commit 13d9b7c3 authored by Andre Freyssinet's avatar Andre Freyssinet

Handles connection retries smartly.

parent 77626ac5
......@@ -197,7 +197,7 @@ public class RestAcquisitionAsync implements AcquisitionDaemon {
private URI uriAcknowledgeMsg = null;
Client client = null;
/**
* Gets destination and initializes the Rest/JMS consumer.
*/
......@@ -851,6 +851,8 @@ public class RestAcquisitionAsync implements AcquisitionDaemon {
setDaemon(true);
}
private int errors = 0;
@Override
public void run() {
if (logger.isLoggable(BasicLevel.INFO))
......@@ -861,11 +863,18 @@ public class RestAcquisitionAsync implements AcquisitionDaemon {
canStop = false;
try {
createConsumer();
errors = 0;
} catch (Exception exc) {
try {
canStop = true;
// TODO (AF): Handles this pause smartly.
Thread.sleep(1000L);
// Handles this pause smartly.
errors += 1;
if (errors < 5)
Thread.sleep(1000L);
else if (errors < 10)
Thread.sleep(10000L);
else
Thread.sleep(60000L);
} catch (InterruptedException ie) {}
canStop = false;
continue;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment