Iterator<P> it = objects.iterator();
int j = 0;
for (int i = 0; i < batchSteps; i++) {
while (it.hasNext() && j < MAX_ITEMS_PER_BATCH) {
ParaObject object = it.next();
if (StringUtils.isBlank(object.getId())) {
object.setId(Utils.getNewId());
}
if (object.getTimestamp() == null) {
object.setTimestamp(Utils.timestamp());
}
if (updateOp) {
object.setUpdated(Utils.timestamp());
}
object.setAppid(appid);
Map<String, AttributeValue> row = toRow(object, null);
setRowKey(object.getId(), row);
reqs.add(new WriteRequest().withPutRequest(new PutRequest().withItem(row)));
j++;
}
batchWrite(Collections.singletonMap(appid, reqs));
reqs.clear();