本文整理汇总了Java中com.amazonaws.services.dynamodbv2.model.TableDescription.getTableStatus方法的典型用法代码示例。如果您正苦于以下问题:Java TableDescription.getTableStatus方法的具体用法?Java TableDescription.getTableStatus怎么用?Java TableDescription.getTableStatus使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.amazonaws.services.dynamodbv2.model.TableDescription
的用法示例。
在下文中一共展示了TableDescription.getTableStatus方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: scaleTable
import com.amazonaws.services.dynamodbv2.model.TableDescription; //导入方法依赖的package包/类
private String scaleTable(String tableName, Long readCapacity, Long writeCapacity)
{
Table table = dynamoDB.getTable(tableName);
ProvisionedThroughput tp = new ProvisionedThroughput();
tp.setReadCapacityUnits(readCapacity);
tp.setWriteCapacityUnits(writeCapacity);
TableDescription d = table.describe();
if (!Objects.equals(d.getProvisionedThroughput().getReadCapacityUnits(), readCapacity)
|| !Objects.equals(d.getProvisionedThroughput().getWriteCapacityUnits(), writeCapacity))
{
d = table.updateTable(tp);
return tableName + "\nRequested read/write : " + readCapacity + "/" + writeCapacity
+ "\nCurrent read/write :" + d.getProvisionedThroughput().getReadCapacityUnits() + "/" + d.getProvisionedThroughput().getWriteCapacityUnits()
+ "\nStatus : " + d.getTableStatus() + "\n";
}
else
{
return tableName + "\n Requested throughput equals current throughput\n";
}
}
示例2: waitForStatus
import com.amazonaws.services.dynamodbv2.model.TableDescription; //导入方法依赖的package包/类
private void waitForStatus(String tableName, TableStatus status) {
logger.info("Waiting for " + tableName + " to become " + status.toString() + "...");
long startTime = System.currentTimeMillis();
long endTime = startTime + (10 * 60 * 1000);
while (System.currentTimeMillis() < endTime) {
try {
Thread.sleep(1000 * 2);
} catch (Exception e) {
}
try {
DescribeTableRequest request = new DescribeTableRequest().withTableName(tableName);
TableDescription tableDescription = dynamoDb.describeTable(request).getTable();
String tableStatus = tableDescription.getTableStatus();
logger.debug(" - current state: " + tableStatus);
if (tableStatus.equals(status.toString()))
return;
} catch (AmazonServiceException ase) {
if (ase.getErrorCode().equalsIgnoreCase("ResourceNotFoundException") == false)
throw ase;
}
}
throw new RuntimeException("Table " + tableName + " never went " + status.toString());
}
示例3: waitForTableToBecomeAvailable
import com.amazonaws.services.dynamodbv2.model.TableDescription; //导入方法依赖的package包/类
private void waitForTableToBecomeAvailable(String tableName) {
System.out.println("Waiting for " + tableName + " to become ACTIVE...");
long startTime = System.currentTimeMillis();
long endTime = startTime + (10 * 60 * 1000);
while (System.currentTimeMillis() < endTime) {
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;
try { Thread.sleep(1000 * 20); } catch (Exception e) { }
}
throw new RuntimeException("Table " + tableName + " never went active");
}
示例4: waitForTableAvailable
import com.amazonaws.services.dynamodbv2.model.TableDescription; //导入方法依赖的package包/类
private void waitForTableAvailable(String tableName) {
LOG.info("Waiting for table " + tableName + " to become ACTIVE...");
long startTime = System.currentTimeMillis();
long endTime = startTime + (10 * 60 * 1000);
while (System.currentTimeMillis() < endTime) {
DescribeTableRequest describeTableRequest = new DescribeTableRequest().withTableName(tableName);
TableDescription tableDescription = dynamoDBClient.describeTable(describeTableRequest).getTable();
// Display current status of table
String tableStatus = tableDescription.getTableStatus();
LOG.info("Current state for table " + tableName + ": " + tableStatus);
if (tableStatus.equals(TableStatus.ACTIVE.toString())) {
return;
}
try {
Thread.sleep(1000 * 20);
} catch (Exception ex) {
LOG.warn(ex.getMessage());
}
}
throw new RuntimeException("Table " + tableName + " never went active");
}
示例5: waitForTableToBeDeleted
import com.amazonaws.services.dynamodbv2.model.TableDescription; //导入方法依赖的package包/类
/**
* Waits up to 6 minutes to confirm if a table has been deleted or not
*
* @param pTableName
*/
private void waitForTableToBeDeleted(String pTableName) {
LOG.debug("Waiting for " + pTableName + " to be deleted.");
long startTime = System.currentTimeMillis();
long endTime = startTime + WAIT_TIME;
while (System.currentTimeMillis() < endTime) {
try {
Thread.sleep(SLEEP_DELETE_TIME);
} catch (Exception e) {
}
try {
DescribeTableRequest request = new DescribeTableRequest()
.withTableName(pTableName);
TableDescription tableDescription = getDynamoDBClient().describeTable(
request).getTable();
String tableStatus = tableDescription.getTableStatus();
LOG.debug(pTableName + " - current state: " + tableStatus);
} catch (AmazonServiceException ase) {
if (ase.getErrorCode().equalsIgnoreCase("ResourceNotFoundException") == true)
return;
LOG.error(ase.getMessage());
}
}
LOG.debug(pTableName + " deleted.");
}
示例6: waitForTableToBecomeAvailable
import com.amazonaws.services.dynamodbv2.model.TableDescription; //导入方法依赖的package包/类
private static void waitForTableToBecomeAvailable(String tableName) {
System.out.println("Waiting for " + tableName + " to become ACTIVE...");
long startTime = System.currentTimeMillis();
long endTime = startTime + (10 * 60 * 1000);
while (System.currentTimeMillis() < endTime) {
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;
try { Thread.sleep(1000 * 20); } catch (Exception e) { }
}
throw new RuntimeException("Table " + tableName + " never went active");
}
示例7: waitForTableToBecomeAvailable
import com.amazonaws.services.dynamodbv2.model.TableDescription; //导入方法依赖的package包/类
private static void waitForTableToBecomeAvailable(String tableName) {
System.out.println("Waiting for " + tableName + " to become ACTIVE...");
long startTime = System.currentTimeMillis();
long endTime = startTime + (10 * 60 * 1000);
while (System.currentTimeMillis() < endTime) {
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;
try {
Thread.sleep(1000 * 20);
} catch (Exception e) {
e.printStackTrace();
}
}
throw new RuntimeException("Table " + tableName + " never went active");
}
示例8: waitForTable
import com.amazonaws.services.dynamodbv2.model.TableDescription; //导入方法依赖的package包/类
private void waitForTable(String name) {
log.info(String.format("Waiting for creation of table '%s' to complete.", name));
long startTime = System.currentTimeMillis();
long endTime = startTime + (10 * 60 * 1000);
while (System.currentTimeMillis() < endTime) {
sleep(1000 * 20);
try {
DescribeTableRequest request = new DescribeTableRequest().withTableName(name);
TableDescription tableDescription = client.describeTable(request).getTable();
String tableStatus = tableDescription.getTableStatus();
log.info(String.format("Table '%s' is in state: '%s'.", name, tableStatus));
if (tableStatus.equals(TableStatus.ACTIVE.toString())) {
return;
}
} catch (ResourceNotFoundException e) {
// nop - maybe the table isn't showing up yet.
}
}
throw new RuntimeException(String.format("Table '%s' never went active.", name));
}
示例9: checkTableStatus
import com.amazonaws.services.dynamodbv2.model.TableDescription; //导入方法依赖的package包/类
private void checkTableStatus(TableDescription tableDescription) throws MetaException {
String status = tableDescription.getTableStatus();
if ("CREATING".equals(status) || "DELETING".equals(status)) {
throw new MetaException("Table " + tableDescription.getTableName() + " is in state "
+ status);
}
}
示例10: waitForTableDeleted
import com.amazonaws.services.dynamodbv2.model.TableDescription; //导入方法依赖的package包/类
private void waitForTableDeleted(String tableName) {
LOG.info("Waiting for table " + tableName + " while status DELETING...");
long startTime = System.currentTimeMillis();
long endTime = startTime + (10 * 60 * 1000);
while (System.currentTimeMillis() < endTime) {
try {
DescribeTableRequest describeTableRequest = new DescribeTableRequest().withTableName(tableName);
TableDescription tableDescription = dynamoDBClient.describeTable(describeTableRequest)
.getTable();
String tableStatus = tableDescription.getTableStatus();
LOG.info("Current state for table " + tableName + ": " + tableStatus);
if (tableStatus.equals(TableStatus.ACTIVE.toString())) {
return;
}
} catch (ResourceNotFoundException rne) {
LOG.warn("Table " + tableName + " is not found. It was deleted.");
return;
}
try {
Thread.sleep(1000 * 20);
} catch (Exception ex) {
LOG.warn(ex.getMessage());
}
}
throw new RuntimeException("Table " + tableName + " was never deleted");
}
示例11: waitForTableToBecomeAvailable
import com.amazonaws.services.dynamodbv2.model.TableDescription; //导入方法依赖的package包/类
/**
* Waits up to 6 minutes to confirm if a table has been created or not
*
* @param awsClient
* @param tableName
*/
public static void waitForTableToBecomeAvailable(AmazonDynamoDB awsClient,
String tableName) {
LOG.debug("Waiting for {} to become available", tableName);
long startTime = System.currentTimeMillis();
long endTime = startTime + WAIT_TIME;
while (System.currentTimeMillis() < endTime) {
try {
Thread.sleep(SLEEP_TIME);
} catch (Exception e) {
}
try {
DescribeTableRequest request = new DescribeTableRequest()
.withTableName(tableName);
TableDescription tableDescription = awsClient.describeTable(request)
.getTable();
String tableStatus = tableDescription.getTableStatus();
LOG.debug("{} - current state: {}", tableName, 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");
}
示例12: waitForTableToBecomeAvailable
import com.amazonaws.services.dynamodbv2.model.TableDescription; //导入方法依赖的package包/类
private static void waitForTableToBecomeAvailable(String tableName)
{
logger.info("Waiting for " + tableName + " to become ACTIVE...");
long startTime = System.currentTimeMillis();
long endTime = startTime + (10 * 60 * 1000);
while (System.currentTimeMillis() < endTime)
{
try
{
Thread.sleep(1000 * 20);
}
catch (Exception e)
{
}
try
{
DescribeTableRequest request = new DescribeTableRequest().withTableName(tableName);
TableDescription tableDescription = dynamoDBClient.describeTable(request).getTable();
String tableStatus = tableDescription.getTableStatus();
logger.info(" - 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 went active");
}
示例13: waitForTableToBecomeAvailable
import com.amazonaws.services.dynamodbv2.model.TableDescription; //导入方法依赖的package包/类
private static void waitForTableToBecomeAvailable(String tableName) {
LOG.info("Waiting for " + tableName + " to become ACTIVE...");
long startTime = System.currentTimeMillis();
long endTime = startTime + (10 * 60 * 1000);
while (System.currentTimeMillis() < endTime) {
try {
Thread.sleep(1000 * 20);
} catch (Exception e) {
}
try {
DescribeTableRequest request = new DescribeTableRequest()
.withTableName(tableName);
TableDescription tableDescription = dynamoDB.describeTable(
request).getTable();
String tableStatus = tableDescription.getTableStatus();
System.out.println(" - 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 went active");
}