本文整理汇总了Java中com.amazonaws.services.dynamodb.model.TableStatus类的典型用法代码示例。如果您正苦于以下问题:Java TableStatus类的具体用法?Java TableStatus怎么用?Java TableStatus使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TableStatus类属于com.amazonaws.services.dynamodb.model包,在下文中一共展示了TableStatus类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: waitForTableToBecomeAvailable
import com.amazonaws.services.dynamodb.model.TableStatus; //导入依赖的package包/类
/**
* Waits up to 6 minutes to confirm if a table has been created or not
* @param pTableName
*/
private void waitForTableToBecomeAvailable(String tableName) {
LOG.debug("Waiting for " + tableName + " to become available");
long startTime = System.currentTimeMillis();
long endTime = startTime + waitTime;
while (System.currentTimeMillis() < endTime) {
try {Thread.sleep(sleepTime);} catch (Exception e) {}
try {
DescribeTableRequest request = new DescribeTableRequest().withTableName(tableName);
TableDescription tableDescription = dynamoDBClient.describeTable(request).getTable();
String tableStatus = tableDescription.getTableStatus();
LOG.debug(tableName + " - current state: " + tableStatus);
if (tableStatus.equals(TableStatus.ACTIVE.toString())) return;
} catch (AmazonServiceException ase) {
if (ase.getErrorCode().equalsIgnoreCase("ResourceNotFoundException") == false) throw ase;
}
}
throw new RuntimeException("Table " + tableName + " never became active");
}