List of usage examples for com.amazonaws.services.dynamodbv2.model PutItemRequest setReturnValues
public void setReturnValues(ReturnValue returnValues)
Use ReturnValues
if you want to get the item attributes as they appeared before they were updated with the PutItem
request.
From source file:AmazonDynamoDBSample_PutThrottled.java
License:Open Source License
private static Thread newItemCreationThread(String tableName, final int thrdNo) { final int ITEM_COUNTS = 1000 * 1000; return new Thread(() -> { for (int c = 0; c < ITEM_COUNTS; c++) { Map<String, AttributeValue> item = new HashMap<>(); String pk = String.format("pk name: thrd %d creates %dth item", thrdNo, c); item.put("name", new AttributeValue(pk)); PutItemRequest req = new PutItemRequest(tableName, item); req.setReturnValues(ReturnValue.ALL_OLD); PutItemResult res = null;// ww w .ja va 2s . c o m long t = System.currentTimeMillis(); try { res = dynamoDB.putItem(req); } catch (Exception exob) { exob.printStackTrace(); } assert 0 == res.getAttributes().size(); System.out.printf("%s. takes %d ms\n", pk, System.currentTimeMillis() - t); } }); }