PreparedStatement ps = null;
try {
String sql = tableManipulation.getDeleteRowSql();
ps = conn.prepareStatement(sql);
int deletionCount = 0;
Bucket bucket;
while (deletionCount < BATCH_SIZE && (bucket = emptyBuckets.poll()) != null) {
ps.setString(1, bucket.getBucketIdAsString());
ps.addBatch();
deletionCount++;
purgedBuckets.add(bucket.getBucketId());
}
log.tracef("Flushing deletion batch");
ps.executeBatch();
log.tracef("Flushed deletion batch");
} catch (Exception ex) {