Selaa lähdekoodia

Sleep between postback IO exceptions

tags/1.0.17
ymlam 3 vuotta sitten
vanhempi
commit
2555d5e4e0
1 muutettua tiedostoa jossa 16 lisäystä ja 2 poistoa
  1. +16
    -2
      src/main/java/altk/comm/engine/Postback.java

+ 16
- 2
src/main/java/altk/comm/engine/Postback.java Näytä tiedosto

@@ -59,12 +59,13 @@ import altk.comm.engine.Broadcast.PostbackThreadActionOnEmpty;
*/
public class Postback
{
private static final String XML_VERSION_1_0_ENCODING_UTF_8 = "<?xml version=\"1.0\" encoding=\"utf-8\"?>";
private static final String XML_VERSION_1_0_ENCODING_UTF_8 = "<?xml version=\"1.0\" encoding=\"utf-8\"?>";
private static final int QUEUE_WAIT = 300; // seconds
private static final int POSTBACK_SERVER_WAIT_TIME = 10; // seconds

private static final int RETRIES_DEFAULT = 3;
private static final int RETRIES_DEFAULT = 5;
private static final int RETRY_SLEEP_SECONDS = 5;
private final String postBackURL;
private final String xmlTopElement;
@@ -134,6 +135,8 @@ public class Postback
switch (post(reportList))
{
case IRRECOVERABLE_ERROR:
// YML: should abort broadcfast to contain damage.
break;
case SUCCESS:
break;
@@ -349,6 +352,17 @@ public class Postback
HttpContext context)
{
if (executionCount >= maxRetries) return false;
if (executionCount > 1)
{
try
{
Thread.sleep(RETRY_SLEEP_SECONDS * 1000);
}
catch (InterruptedException ex)
{
// ignore
}
}
return true;
}
};


Ladataan…
Peruuta
Tallenna