Amazon dynamodb 正在等待从数据库中删除DynamoDB表
我在DynamoDB中找到了这个关于同步删除给定表的示例 在调用此方法之前,我们使用类Amazon dynamodb 正在等待从数据库中删除DynamoDB表,amazon-dynamodb,Amazon Dynamodb,我在DynamoDB中找到了这个关于同步删除给定表的示例 在调用此方法之前,我们使用类DeleteTableRequest发送了删除表的请求 private static void waitForTableToBeDeleted(String tableName) { System.out.println("Waiting for " + tableName + " while status DELETING..."); long startTime = Sys
DeleteTableRequest
发送了删除表的请求
private static void waitForTableToBeDeleted(String tableName) {
System.out.println("Waiting for " + tableName + " while status DELETING...");
long startTime = System.currentTimeMillis();
long endTime = startTime + (10 * 60 * 1000);
while (System.currentTimeMillis() < endTime) {
try {
DescribeTableRequest request = new DescribeTableRequest().withTableName(tableName);
TableDescription tableDescription = client.describeTable(request).getTable();
String tableStatus = tableDescription.getTableStatus();
System.out.println(" - current state: " + tableStatus);
if (tableStatus.equals(TableStatus.ACTIVE.toString())) return;
} catch (ResourceNotFoundException e) {
System.out.println("Table " + tableName + " is not found. It was deleted.");
return;
}
try {Thread.sleep(1000 * 20);} catch (Exception e) {}
}
throw new RuntimeException("Table " + tableName + " was never deleted");
}
private static void waitForTableToBeDeleted(字符串tableName){
System.out.println(“正在等待“+tableName+”而状态正在删除…”);
long startTime=System.currentTimeMillis();
长结束时间=开始时间+(10*60*1000);
while(System.currentTimeMillis()
我的问题是,他们在最新的示例中如何使用
ResourceNotFoundException
,当他们在中提到不推荐使用的时?我们应该使用什么来代替呢?您所指的文档链接是针对Amazon DynamoDB API的V1,该API已被弃用。V2版本引入了本地二级索引,包含在com.amazonaws.services.dynamodbv2
包中。这是ResourceNotFoundException
的V2