IDEMPIERE-4154 ServerPush Adjustments. Make another 2 adjustment as there are still report of slowness due to failure to resume long polling resource.

This commit is contained in:
hengsin 2020-02-04 10:56:33 +08:00
parent fc79f86973
commit a64ccd107e
1 changed files with 16 additions and 18 deletions

View File

@ -191,6 +191,7 @@ public class AtmosphereServerPush implements ServerPush {
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
} }
if (!ok) { if (!ok) {
for(int i = 0; i < 3 && !ok; i++) {
try { try {
Thread.sleep(500); Thread.sleep(500);
} catch (InterruptedException e1) {} } catch (InterruptedException e1) {}
@ -200,11 +201,14 @@ public class AtmosphereServerPush implements ServerPush {
} catch (IOException e) { } catch (IOException e) {
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
} }
} else {
ok = true;
}
}
if (!ok) { if (!ok) {
log.warn("Failed to resume long polling resource"); log.warn("Failed to resume long polling resource");
} }
} }
}
} else { } else {
//in event listener thread, can schedule immediately //in event listener thread, can schedule immediately
scheduler.schedule(task, event); scheduler.schedule(task, event);
@ -252,12 +256,6 @@ public class AtmosphereServerPush implements ServerPush {
log.trace(resource.transport().name()); log.trace(resource.transport().name());
} }
try {
commitResponse();
} catch (IOException e) {
log.error(e.getLocalizedMessage(), e);
}
DesktopCtrl desktopCtrl = (DesktopCtrl) this.desktop.get(); DesktopCtrl desktopCtrl = (DesktopCtrl) this.desktop.get();
if (desktopCtrl == null) { if (desktopCtrl == null) {
log.error("No desktop available"); log.error("No desktop available");