return resultSet;
}
private void processBatchGetRequest(Map<String, Class<?>> tableNameToClassMapper,
Map<String, KeysAndAttributes> requestItems, Map<String, List<Object>> resultSet) {
BatchGetItemResult batchGetItemResult = null;
BatchGetItemRequest batchGetItemRequest = new BatchGetItemRequest();
batchGetItemRequest.setRequestItems(requestItems);
do {
if (batchGetItemResult != null) {
batchGetItemRequest.setRequestItems(batchGetItemResult.getUnprocessedKeys());
}
batchGetItemResult = db.batchGetItem(batchGetItemRequest);
Map<String, BatchResponse> responses = batchGetItemResult.getResponses();
for (String tableName : responses.keySet()) {
BatchResponse batchResponse = responses.get(tableName);
List<Object> objects = null;
if (resultSet.get(tableName) != null) {
objects = resultSet.get(tableName);
} else {
objects = new LinkedList<Object>();
}
List<Map<String, AttributeValue>> items = batchResponse.getItems();
for (Map<String, AttributeValue> item : items) {
objects.add((Object) marshallIntoObject(tableNameToClassMapper.get(tableName), item));
}
resultSet.put(tableName, objects);
}
// To see whether there are unprocessed keys.
} while (batchGetItemResult.getUnprocessedKeys() != null && batchGetItemResult.getUnprocessedKeys().size() > 0);
}