Use "count" var to determine how many rows have been processed

This commit is contained in:
Philip Cass
2015-03-22 15:04:27 +00:00
parent 21a74dc7b2
commit 7c52c10922

View File

@@ -293,13 +293,14 @@ public class Consumer extends TimerTask
getLogger().info("[Consumer] Queue overloaded. Size: " + getQueueSize());
}
int count = 0;
try {
if (conn == null)
return;
conn.setAutoCommit(false);
state = conn.createStatement();
final long start = System.currentTimeMillis();
int count = 0;
process:
while (!queue.isEmpty() && (System.currentTimeMillis() - start < timePerRun || count < forceToProcessAtLeast)) {
final Row r = queue.poll();
@@ -371,10 +372,9 @@ public class Consumer extends TimerTask
if (debug) {
long timeElapsed = System.currentTimeMillis() - startTime;
int rowsProcessed = startSize - queue.size();
float rowPerTime = rowsProcessed / timeElapsed;
float rowPerTime = count / timeElapsed;
getLogger().log(Level.INFO, "[Consumer] Finished consumer cycle in " + timeElapsed + " milliseconds.");
getLogger().log(Level.INFO, "[Consumer] Total rows processed: " + rowsProcessed + ". row/time: " + String.format("%.4f", rowPerTime));
getLogger().log(Level.INFO, "[Consumer] Total rows processed: " + count + ". row/time: " + String.format("%.4f", rowPerTime));
}
}
}