| @@ -108,7 +108,11 @@ public class PostBack | |||
| if (report == null) break; | |||
| reportList.add(report); | |||
| } | |||
| if (reportList.size() > 0) break; // break out to do the work. | |||
| if (reportList.size() > 0) | |||
| { | |||
| postQueue.notify(); | |||
| break; // break out to do the work. | |||
| } | |||
| // Nothing to do, so wait a while, and look at the | |||
| // queue again. | |||
| @@ -136,8 +140,11 @@ public class PostBack | |||
| case SERVER_IO_ERROR: | |||
| // TODO: Limit retries, using rate limiting. Posting can be recovered using the activity log. | |||
| // Re-queue this job | |||
| queueReports(reportList); | |||
| // Re-queue these reports | |||
| for (String rpt : reportList) | |||
| { | |||
| queueReport(rpt); | |||
| } | |||
| // Sleep for a while before retrying this PostBack server. | |||
| CommonLogger.alarm.warn(getName() + ": Caught server IO error. sleep for " + POSTBACK_SERVER_WAIT_TIME + " seconds"); | |||
| try | |||
| @@ -372,14 +379,29 @@ public class PostBack | |||
| myLogger.debug(myName + ": postQueue size: " + postQueue.size()); | |||
| synchronized(postQueue) | |||
| { | |||
| if (postQueue.size() < maxQueueSize) | |||
| { | |||
| postQueue.add(report); | |||
| postQueue.notify(); | |||
| return true; | |||
| for (;;) | |||
| { | |||
| if (postQueue.size() < maxQueueSize) | |||
| { | |||
| postQueue.add(report); | |||
| postQueue.notify(); | |||
| return true; | |||
| } | |||
| else | |||
| { | |||
| myLogger.debug("Waiting for space in postQueue to queue report"); | |||
| try | |||
| { | |||
| postQueue.wait(); | |||
| } | |||
| catch (InterruptedException e) | |||
| { | |||
| break; | |||
| } | |||
| } | |||
| } | |||
| } | |||
| CommonLogger.alarm.warn(myName + ".queueReport method returning false"); | |||
| myLogger.error("Interrupted while waiting for space to queue report"); | |||
| return false; | |||
| } | |||
| @@ -389,6 +411,8 @@ public class PostBack | |||
| * @param reports to be added back to postQueue | |||
| * @return true if all jobs have been added to queue, false otherwise (queue full) | |||
| */ | |||
| /* | |||
| @Deprecated | |||
| public boolean queueReports(List<String> reports) | |||
| { | |||
| myLogger.debug(myName + ": postQueue size: " + postQueue.size()); | |||
| @@ -416,6 +440,7 @@ public class PostBack | |||
| return returnValue; | |||
| } | |||
| } | |||
| */ | |||
| public void terminate() | |||
| { | |||