• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java BatchWriteItemRequest类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.amazonaws.services.dynamodbv2.model.BatchWriteItemRequest的典型用法代码示例。如果您正苦于以下问题:Java BatchWriteItemRequest类的具体用法?Java BatchWriteItemRequest怎么用?Java BatchWriteItemRequest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



BatchWriteItemRequest类属于com.amazonaws.services.dynamodbv2.model包,在下文中一共展示了BatchWriteItemRequest类的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: sendDeleteRequests

import com.amazonaws.services.dynamodbv2.model.BatchWriteItemRequest; //导入依赖的package包/类
public int sendDeleteRequests() throws IllegalArgumentException {
    if (batchDeleteRequests.isEmpty()) {
        return 0;
    }
    BatchWriteItemRequest batchWriteItemRequest = genBatchWriteItemRequest();
    BatchWriteItemResult bathWriteResult = sendBatchWriteRequest(batchWriteItemRequest);
    int undeletedItemNum = countAndPrintUndeletedItems(bathWriteResult);
    if(!isRunningOnDDBLocal) {
        // DDB Local does not support rate limiting
        tableWriteRateLimiter.adjustRateWithConsumedCapacity(bathWriteResult.getConsumedCapacity());
    }
    int deletedRequest = batchDeleteRequests.size() - undeletedItemNum;
    totalNumOfItemsDeleted += deletedRequest;
    PrintHelper.printDeleteProgressInfo(deletedRequest, totalNumOfItemsDeleted);
    batchDeleteRequests = new ArrayList<WriteRequest>();
    return deletedRequest;
}
 
开发者ID:awslabs,项目名称:dynamodb-online-index-violation-detector,代码行数:18,代码来源:TableWriter.java


示例2: storeResult

import com.amazonaws.services.dynamodbv2.model.BatchWriteItemRequest; //导入依赖的package包/类
private void storeResult(final Map<String, Object> result) {
    final String userId = (String) result.get("user_id");
    final String userToken = (String) result.get("access_token");
    final String teamId = (String) result.get("team_id");
    @SuppressWarnings("unchecked")
    final Map<String, Object> bot = (Map<String, Object>) result.get("bot");
    final String botToken = (String) bot.get("bot_access_token");
    final String botId = (String) bot.get("bot_user_id");

    final ArrayList<PutRequest> putRequests = new ArrayList<>();

    putRequests.add(item("user:" + userId + ":token", userToken));
    putRequests.add(item("user:" + botId + ":token", botToken));
    putRequests.add(item("team:" + teamId + ":botuser", botId));

    final List<WriteRequest> writeRequests = putRequests.stream()
            .map(WriteRequest::new)
            .collect(Collectors.toList());
    final HashMap<String, List<WriteRequest>> requestItems = new HashMap<>();
    requestItems.put(TableName, writeRequests);
    final BatchWriteItemRequest batchWriteItemRequest = new BatchWriteItemRequest().withRequestItems(requestItems);

    ddb.batchWriteItem(batchWriteItemRequest);
}
 
开发者ID:aztecrex,项目名称:java-translatebot,代码行数:25,代码来源:OauthHandler.java


示例3: writeResult

import com.amazonaws.services.dynamodbv2.model.BatchWriteItemRequest; //导入依赖的package包/类
/**
 * calls splitResultIntoBatches to turn the SegmentedScanResult into several
 * BatchWriteItemRequests and then submits them as individual jobs to the
 * ExecutorService.
 */
@Override
public Future<Void> writeResult(SegmentedScanResult result) {
    Future<Void> jobSubmission = null;
    List<BatchWriteItemRequest> batches = splitResultIntoBatches(
            result.getScanResult(), tableName);
    Iterator<BatchWriteItemRequest> batchesIterator = batches.iterator();
    while (batchesIterator.hasNext()) {
        try {
            jobSubmission = exec
                    .submit(new DynamoDBConsumerWorker(batchesIterator
                            .next(), client, rateLimiter, tableName));
        } catch (NullPointerException npe) {
            throw new NullPointerException(
                    "Thread pool not initialized for LogStashExecutor");
        }
    }
    return jobSubmission;
}
 
开发者ID:awslabs,项目名称:dynamodb-import-export-tool,代码行数:24,代码来源:DynamoDBConsumer.java


示例4: batchWrite

import com.amazonaws.services.dynamodbv2.model.BatchWriteItemRequest; //导入依赖的package包/类
/**
 * Writes multiple items in batch.
 * @param items a map of tables->write requests
 */
protected static void batchWrite(Map<String, List<WriteRequest>> items) {
	if (items == null || items.isEmpty()) {
		return;
	}
	try {
		BatchWriteItemResult result = getClient().batchWriteItem(new BatchWriteItemRequest().
				withReturnConsumedCapacity(ReturnConsumedCapacity.TOTAL).withRequestItems(items));
		if (result == null) {
			return;
		}
		logger.debug("batchWrite(): total {}, cc {}", items.size(), result.getConsumedCapacity());

		if (result.getUnprocessedItems() != null && !result.getUnprocessedItems().isEmpty()) {
			Thread.sleep(1000);
			logger.warn("{} UNPROCESSED write requests!", result.getUnprocessedItems().size());
			batchWrite(result.getUnprocessedItems());
		}
	} catch (Exception e) {
		logger.error(null, e);
	}
}
 
开发者ID:Erudika,项目名称:para,代码行数:26,代码来源:AWSDynamoUtils.java


示例5: commitPartial

import com.amazonaws.services.dynamodbv2.model.BatchWriteItemRequest; //导入依赖的package包/类
private void commitPartial(List<WriteRequest> list) {
  	Timer t = new Timer();
Map<String, List<WriteRequest>> map = new HashMap<>();
map.put(getTenant().getName(), list);
BatchWriteItemResult result = m_client.batchWriteItem(new BatchWriteItemRequest(map));
int retry = 0;
while(result.getUnprocessedItems().size() > 0) {
	if(retry == RETRY_SLEEPS.length) throw new RuntimeException("All retries failed");
	m_logger.debug("Committing {} unprocessed items, retry: {}", result.getUnprocessedItems().size(), retry + 1);
	try {
		Thread.sleep(RETRY_SLEEPS[retry++]);
	} catch (InterruptedException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
  		result = m_client.batchWriteItem(new BatchWriteItemRequest(result.getUnprocessedItems()));
}
m_logger.debug("Committed {} writes in {}", list.size(), t);
list.clear();
  }
 
开发者ID:QSFT,项目名称:Doradus,代码行数:21,代码来源:DynamoDBService2.java


示例6: batchWriteItem

import com.amazonaws.services.dynamodbv2.model.BatchWriteItemRequest; //导入依赖的package包/类
public CompletableFuture<BatchWriteItemResult> batchWriteItem(final BatchWriteItemRequest batchWriteItemRequest) {
    return asyncExecutor.execute(new Callable<BatchWriteItemResult>() {
        @Override
        public BatchWriteItemResult call() throws Exception {
            return dbExecutor.batchWriteItem(batchWriteItemRequest);
        }
    });
}
 
开发者ID:landawn,项目名称:AbacusUtil,代码行数:9,代码来源:AsyncDynamoDBExecutor.java


示例7: sendBatch

import com.amazonaws.services.dynamodbv2.model.BatchWriteItemRequest; //导入依赖的package包/类
/**
 * @param tableName
 * @param requests
 */
private void sendBatch(final String tableName, List<WriteRequest> requests) {
    int numBatches = (int) Math.ceil(requests.size() / (BATCH_SIZE * 1D));
    for (int i = 0; i < numBatches; i++) {
        Map<String, List<WriteRequest>> requestItems = new HashMap<String, List<WriteRequest>>();
        List<WriteRequest> batch = requests.subList(i * BATCH_SIZE,
                Math.min(i * BATCH_SIZE + BATCH_SIZE, requests.size()));
        requestItems.put(tableName, batch);
        addItemsToTable(tableName, new BatchWriteItemRequest().withRequestItems(requestItems));
    }
}
 
开发者ID:intuit,项目名称:Tank,代码行数:15,代码来源:AmazonDynamoDatabaseDocApi.java


示例8: DynamoDBConsumerWorker

import com.amazonaws.services.dynamodbv2.model.BatchWriteItemRequest; //导入依赖的package包/类
/**
 * Callable class that when called will try to write a batch to a DynamoDB
 * table. If the write returns unprocessed items it will exponentially back
 * off until it succeeds.
 */
public DynamoDBConsumerWorker(BatchWriteItemRequest batchWriteItemRequest,
        AmazonDynamoDBClient client, RateLimiter rateLimiter,
        String tableName) {
    this.batch = batchWriteItemRequest;
    this.client = client;
    this.rateLimiter = rateLimiter;
    this.tableName = tableName;
    this.exponentialBackoffTime = BootstrapConstants.INITIAL_RETRY_TIME_MILLISECONDS;
}
 
开发者ID:awslabs,项目名称:dynamodb-import-export-tool,代码行数:15,代码来源:DynamoDBConsumerWorker.java


示例9: runWithBackoff

import com.amazonaws.services.dynamodbv2.model.BatchWriteItemRequest; //导入依赖的package包/类
/**
 * Writes to DynamoDBTable using an exponential backoff. If the
 * batchWriteItem returns unprocessed items then it will exponentially
 * backoff and retry the unprocessed items.
 */
public List<ConsumedCapacity> runWithBackoff(BatchWriteItemRequest req) {
    BatchWriteItemResult writeItemResult = null;
    List<ConsumedCapacity> consumedCapacities = new LinkedList<ConsumedCapacity>();
    Map<String, List<WriteRequest>> unprocessedItems = null;
    boolean interrupted = false;
    try {
        do {
            writeItemResult = client.batchWriteItem(req);
            unprocessedItems = writeItemResult.getUnprocessedItems();
            consumedCapacities
                    .addAll(writeItemResult.getConsumedCapacity());

            if (unprocessedItems != null) {
                req.setRequestItems(unprocessedItems);
                try {
                    Thread.sleep(exponentialBackoffTime);
                } catch (InterruptedException ie) {
                    interrupted = true;
                } finally {
                    exponentialBackoffTime *= 2;
                    if (exponentialBackoffTime > BootstrapConstants.MAX_EXPONENTIAL_BACKOFF_TIME) {
                        exponentialBackoffTime = BootstrapConstants.MAX_EXPONENTIAL_BACKOFF_TIME;
                    }
                }
            }
        } while (unprocessedItems != null && unprocessedItems.get(tableName) != null);
        return consumedCapacities;
    } finally {
        if (interrupted) {
            Thread.currentThread().interrupt();
        }
    }
}
 
开发者ID:awslabs,项目名称:dynamodb-import-export-tool,代码行数:39,代码来源:DynamoDBConsumerWorker.java


示例10: splitResultIntoBatches

import com.amazonaws.services.dynamodbv2.model.BatchWriteItemRequest; //导入依赖的package包/类
/**
 * Splits up a ScanResult into a list of BatchWriteItemRequests of size 25
 * items or less each.
 */
public static List<BatchWriteItemRequest> splitResultIntoBatches(
        ScanResult result, String tableName) {
    List<BatchWriteItemRequest> batches = new LinkedList<BatchWriteItemRequest>();
    Iterator<Map<String, AttributeValue>> it = result.getItems().iterator();

    BatchWriteItemRequest req = new BatchWriteItemRequest()
            .withReturnConsumedCapacity(ReturnConsumedCapacity.TOTAL);
    List<WriteRequest> writeRequests = new LinkedList<WriteRequest>();
    int i = 0;
    while (it.hasNext()) {
        PutRequest put = new PutRequest(it.next());
        writeRequests.add(new WriteRequest(put));

        i++;
        if (i == BootstrapConstants.MAX_BATCH_SIZE_WRITE_ITEM) {
            req.addRequestItemsEntry(tableName, writeRequests);
            batches.add(req);
            req = new BatchWriteItemRequest()
                    .withReturnConsumedCapacity(ReturnConsumedCapacity.TOTAL);
            writeRequests = new LinkedList<WriteRequest>();
            i = 0;
        }
    }
    if (i > 0) {
        req.addRequestItemsEntry(tableName, writeRequests);
        batches.add(req);
    }
    return batches;
}
 
开发者ID:awslabs,项目名称:dynamodb-import-export-tool,代码行数:34,代码来源:DynamoDBConsumer.java


示例11: splitResultIntoBatchesTest

import com.amazonaws.services.dynamodbv2.model.BatchWriteItemRequest; //导入依赖的package包/类
/**
 * Test that a ScanResult splits into the correct number of batches.
 */
@Test
public void splitResultIntoBatchesTest() {
    final double numItems = 111.0;

    String tableName = "test tableName";

    ScanResult scanResult = new ScanResult();
    List<Map<String, AttributeValue>> items = new LinkedList<Map<String, AttributeValue>>();
    for (int i = 0; i < numItems; i++) {
        Map<String, AttributeValue> sampleScanResult = new HashMap<String, AttributeValue>();
        sampleScanResult.put("key", new AttributeValue("attribute value "
                + i));
        items.add(sampleScanResult);
    }
    scanResult.setItems(items);

    SegmentedScanResult result = new SegmentedScanResult(scanResult, 0);

    replayAll();
    List<BatchWriteItemRequest> batches = DynamoDBConsumer
            .splitResultIntoBatches(result.getScanResult(), tableName);
    assertEquals(Math.ceil(numItems / BootstrapConstants.MAX_BATCH_SIZE_WRITE_ITEM),
            batches.size(), 0.0);

    verifyAll();
}
 
开发者ID:awslabs,项目名称:dynamodb-import-export-tool,代码行数:30,代码来源:DynamoDBConsumerTest.java


示例12: sendBatchWriteRequest

import com.amazonaws.services.dynamodbv2.model.BatchWriteItemRequest; //导入依赖的package包/类
protected BatchWriteItemResult sendBatchWriteRequest(BatchWriteItemRequest batchWriteItemRequest) {
    try {
        return dynamoDBClient.batchWriteItem(batchWriteItemRequest);
    } catch (AmazonServiceException ase) {
        throw new IllegalArgumentException("Error: Failed to delete " + ase.getMessage());
    } catch (IllegalArgumentException iae) {
        throw new IllegalArgumentException("Error: Invalid argument: " + iae.getMessage());
    }
}
 
开发者ID:awslabs,项目名称:dynamodb-online-index-violation-detector,代码行数:10,代码来源:TableWriter.java


示例13: batchWritePoints

import com.amazonaws.services.dynamodbv2.model.BatchWriteItemRequest; //导入依赖的package包/类
public BatchWritePointResult batchWritePoints(List<PutPointRequest> putPointRequests) {
	BatchWriteItemRequest batchItemRequest = new BatchWriteItemRequest();
	List<WriteRequest> writeRequests = new ArrayList<WriteRequest>();
	for (PutPointRequest putPointRequest : putPointRequests) {
		long geohash = S2Manager.generateGeohash(putPointRequest.getGeoPoint());
		long hashKey = S2Manager.generateHashKey(geohash, config.getHashKeyLength());
		String geoJson = GeoJsonMapper.stringFromGeoObject(putPointRequest.getGeoPoint());

		PutRequest putRequest = putPointRequest.getPutRequest();
		AttributeValue hashKeyValue = new AttributeValue().withN(String.valueOf(hashKey));
		putRequest.getItem().put(config.getHashKeyAttributeName(), hashKeyValue);
		putRequest.getItem().put(config.getRangeKeyAttributeName(), putPointRequest.getRangeKeyValue());
		AttributeValue geohashValue = new AttributeValue().withN(Long.toString(geohash));
		putRequest.getItem().put(config.getGeohashAttributeName(), geohashValue);
		AttributeValue geoJsonValue = new AttributeValue().withS(geoJson);
		putRequest.getItem().put(config.getGeoJsonAttributeName(), geoJsonValue);			
		
		WriteRequest writeRequest = new WriteRequest(putRequest);
		writeRequests.add(writeRequest);
	}
	Map<String, List<WriteRequest>> requestItems = new HashMap<String, List<WriteRequest>>();
	requestItems.put(config.getTableName(), writeRequests);
	batchItemRequest.setRequestItems(requestItems);
	BatchWriteItemResult batchWriteItemResult = config.getDynamoDBClient().batchWriteItem(batchItemRequest);
	BatchWritePointResult batchWritePointResult = new BatchWritePointResult(batchWriteItemResult);
	return batchWritePointResult;
}
 
开发者ID:awslabs,项目名称:dynamodb-geo,代码行数:28,代码来源:DynamoDBManager.java


示例14: batchWriteItem

import com.amazonaws.services.dynamodbv2.model.BatchWriteItemRequest; //导入依赖的package包/类
public BatchWriteItemResult batchWriteItem(final BatchWriteItemRequest batchWriteItemRequest) {
    return dynamoDB.batchWriteItem(batchWriteItemRequest);
}
 
开发者ID:landawn,项目名称:AbacusUtil,代码行数:4,代码来源:DynamoDBExecutor.java


示例15: batchWriteItem

import com.amazonaws.services.dynamodbv2.model.BatchWriteItemRequest; //导入依赖的package包/类
public BatchWriteItemResult batchWriteItem(final BatchWriteItemRequest batchRequest) throws BackendException {
    int count = 0;
    for (Entry<String, List<WriteRequest>> entry : batchRequest.getRequestItems().entrySet()) {
        final String tableName = entry.getKey();
        final List<WriteRequest> requests = entry.getValue();
        count += requests.size();
        if (count > BATCH_WRITE_MAX_NUMBER_OF_ITEMS) {
            throw new IllegalArgumentException("cant have more than 25 requests in a batchwrite");
        }
        for (final WriteRequest request : requests) {
            if ((request.getPutRequest() != null) == (request.getDeleteRequest() != null)) {
                throw new IllegalArgumentException("Exactly one of PutRequest or DeleteRequest must be set in each WriteRequest in a batch write operation");
            }
            final int wcu;
            final String apiName;
            if (request.getPutRequest() != null) {
                apiName = PUT_ITEM;
                final int bytes = calculateItemSizeInBytes(request.getPutRequest().getItem());
                wcu = computeWcu(bytes);
            } else { //deleterequest
                apiName = DELETE_ITEM;
                wcu = estimateCapacityUnits(apiName, tableName);
            }
            timedWriteThrottle(apiName, tableName, wcu);
        }
    }

    BatchWriteItemResult result;
    setUserAgent(batchRequest);
    final Timer.Context apiTimerContext = getTimerContext(BATCH_WRITE_ITEM, null /*tableName*/);
    try {
        result = client.batchWriteItem(batchRequest);
    } catch (Exception e) {
        throw processDynamoDbApiException(e, BATCH_WRITE_ITEM, null /*tableName*/);
    } finally {
        apiTimerContext.stop();
    }
    if (result.getConsumedCapacity() != null) {
        for (ConsumedCapacity ccu : result.getConsumedCapacity()) {
            meterConsumedCapacity(BATCH_WRITE_ITEM, ccu);
        }
    }
    return result;
}
 
开发者ID:awslabs,项目名称:dynamodb-janusgraph-storage-backend,代码行数:45,代码来源:DynamoDbDelegate.java


示例16: genBatchWriteItemRequest

import com.amazonaws.services.dynamodbv2.model.BatchWriteItemRequest; //导入依赖的package包/类
protected BatchWriteItemRequest genBatchWriteItemRequest() {
    Map<String, List<WriteRequest>> requestItems = new HashMap<String, List<WriteRequest>>();
    requestItems.put(tableName, batchDeleteRequests);
    return new BatchWriteItemRequest().withRequestItems(requestItems).withReturnConsumedCapacity(ReturnConsumedCapacity.TOTAL);
}
 
开发者ID:awslabs,项目名称:dynamodb-online-index-violation-detector,代码行数:6,代码来源:TableWriter.java


示例17: writeMultipleItemsBatchWrite

import com.amazonaws.services.dynamodbv2.model.BatchWriteItemRequest; //导入依赖的package包/类
private static void writeMultipleItemsBatchWrite() {
     try {
                   
// Begin syntax extract
         
         
// Create a map for the requests in the batch
Map<String, List<WriteRequest>> requestItems = new HashMap<String, List<WriteRequest>>();
 
// Create a PutRequest for a new Forum item
Map<String, AttributeValue> forumItem = new HashMap<String, AttributeValue>();
forumItem.put("Name", new AttributeValue().withS("Amazon RDS"));
forumItem.put("Threads", new AttributeValue().withN("0"));

List<WriteRequest> forumList = new ArrayList<WriteRequest>();
forumList.add(new WriteRequest().withPutRequest(new PutRequest().withItem(forumItem)));
requestItems.put("Forum", forumList);

// Create a PutRequest for a new Thread item
Map<String, AttributeValue> threadItem = new HashMap<String, AttributeValue>();
threadItem.put("ForumName", new AttributeValue().withS("Amazon RDS"));
threadItem.put("Subject", new AttributeValue().withS("Amazon RDS Thread 1"));

List<WriteRequest> threadList = new ArrayList<WriteRequest>();
threadList.add(new WriteRequest().withPutRequest(new PutRequest().withItem(threadItem)));

// Create a DeleteRequest for a Thread item
Map<String, AttributeValue> threadDeleteKey = new HashMap<String, AttributeValue>(); 
threadDeleteKey.put("ForumName", new AttributeValue().withS("Some hash attribute value"));
threadDeleteKey.put("Subject", new AttributeValue().withS("Some range attribute value"));

threadList.add(new WriteRequest().withDeleteRequest(new DeleteRequest().withKey(threadDeleteKey)));
requestItems.put("Thread", threadList);

BatchWriteItemRequest batchWriteItemRequest = new BatchWriteItemRequest();

System.out.println("Making the request.");
                     
batchWriteItemRequest.withRequestItems(requestItems);
client.batchWriteItem(batchWriteItemRequest);

// End syntax extract

                     
     }  catch (AmazonServiceException ase) {
         System.err.println("Failed to retrieve items: ");
         ase.printStackTrace(System.err);
     }  

 }
 
开发者ID:awslabs,项目名称:aws-dynamodb-examples,代码行数:51,代码来源:LowLevelBatchWriteSyntax.java


示例18: writeMultipleItemsBatchWrite

import com.amazonaws.services.dynamodbv2.model.BatchWriteItemRequest; //导入依赖的package包/类
private static void writeMultipleItemsBatchWrite() {
    try {                    
        
       // Create a map for the requests in the batch
       Map<String, List<WriteRequest>> requestItems = new HashMap<String, List<WriteRequest>>();
        
       // Create a PutRequest for a new Forum item
       Map<String, AttributeValue> forumItem = new HashMap<String, AttributeValue>();
       forumItem.put("Name", new AttributeValue().withS("Amazon RDS"));
       forumItem.put("Threads", new AttributeValue().withN("0"));
    
       List<WriteRequest> forumList = new ArrayList<WriteRequest>();
       forumList.add(new WriteRequest().withPutRequest(new PutRequest().withItem(forumItem)));
       requestItems.put(table1Name, forumList);
       
       // Create a PutRequest for a new Thread item
       Map<String, AttributeValue> threadItem = new HashMap<String, AttributeValue>();
       threadItem.put("ForumName", new AttributeValue().withS("Amazon RDS"));
       threadItem.put("Subject", new AttributeValue().withS("Amazon RDS Thread 1"));
       threadItem.put("Message", new AttributeValue().withS("ElasticCache Thread 1 message"));
       threadItem.put("KeywordTags", new AttributeValue().withSS(Arrays.asList("cache", "in-memory")));
    
       List<WriteRequest> threadList = new ArrayList<WriteRequest>();
       threadList.add(new WriteRequest().withPutRequest(new PutRequest().withItem(threadItem)));
       
       // Create a DeleteRequest for a Thread item
       Map<String, AttributeValue> threadDeleteKey = new HashMap<String, AttributeValue>(); 
       threadDeleteKey.put("ForumName", new AttributeValue().withS("Amazon S3"));
       threadDeleteKey.put("Subject", new AttributeValue().withS("S3 Thread 100"));
       
       threadList.add(new WriteRequest().withDeleteRequest(new DeleteRequest().withKey(threadDeleteKey)));
       requestItems.put(table2Name, threadList);
       
       BatchWriteItemResult result;
       BatchWriteItemRequest batchWriteItemRequest = new BatchWriteItemRequest()
           .withReturnConsumedCapacity(ReturnConsumedCapacity.TOTAL);
       
       do {
           System.out.println("Making the request.");
                           
           batchWriteItemRequest.withRequestItems(requestItems);
           result = client.batchWriteItem(batchWriteItemRequest);
           
           // Print consumed capacity units
           for(ConsumedCapacity consumedCapacity : result.getConsumedCapacity()) {
                String tableName = consumedCapacity.getTableName();
                Double consumedCapacityUnits = consumedCapacity.getCapacityUnits();
                System.out.println("Consumed capacity units for table " + tableName + ": " + consumedCapacityUnits);
           }
           
           // Check for unprocessed keys which could happen if you exceed provisioned throughput
           System.out.println("Unprocessed Put and Delete requests: \n" + result.getUnprocessedItems());
           requestItems = result.getUnprocessedItems();
       } while (result.getUnprocessedItems().size() > 0);
                    
    }  catch (AmazonServiceException ase) {
        System.err.println("Failed to retrieve items: ");
        ase.printStackTrace(System.err);
    }  

}
 
开发者ID:awslabs,项目名称:aws-dynamodb-examples,代码行数:62,代码来源:LowLevelBatchWrite.java



注:本文中的com.amazonaws.services.dynamodbv2.model.BatchWriteItemRequest类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Time类代码示例发布时间:2022-05-22
下一篇:
Java AFUNIXSocket类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap