*/
public static synchronized int flush() {
int numRemoved = 0;
if (!reportQueue.isEmpty() && (errplaneUrl != null)) {
int bytesWritten = 0;
HTTPPostHelper postHelper = new HTTPPostHelper();
try {
while (!reportQueue.isEmpty() && (numRemoved < 200)) {
ReportHelper rh = reportQueue.remove();
numRemoved++;
String rptBody = rh.getReportBody();
bytesWritten += rptBody.length() + 1;
OutputStream os = postHelper.getOutputStream(errplaneUrl, bytesWritten);
os.write(rptBody.getBytes());
os.write('\n');
if (!postHelper.sendPost(bytesWritten)) {
System.out.println("Cannot send tick to server");
}
}
}
catch (Exception e) {