当前位置: 首页>>代码示例>>Java>>正文


Java TableDescription.getTableStatus方法代码示例

本文整理汇总了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";
    }
}
 
开发者ID:dhorions,项目名称:lambdaDynamodbScaler,代码行数:21,代码来源:Scaler.java

示例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());
}
 
开发者ID:intuit,项目名称:Tank,代码行数:26,代码来源:AmazonDynamoDatabaseDocApi.java

示例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");
}
 
开发者ID:awslabs,项目名称:dynamodb-online-index-violation-detector,代码行数:18,代码来源:TableManager.java

示例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");
}
 
开发者ID:dgks0n,项目名称:milton-aws,代码行数:26,代码来源:DynamoDBServiceImpl.java

示例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.");
}
 
开发者ID:apache,项目名称:gora,代码行数:30,代码来源:DynamoDBStore.java

示例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");
}
 
开发者ID:awslabs,项目名称:aws-dynamodb-examples,代码行数:19,代码来源:LowLevelTableExample.java

示例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");
}
 
开发者ID:awslabs,项目名称:aws-dynamodb-examples,代码行数:26,代码来源:LowLevelGlobalSecondaryIndexExample.java

示例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));
}
 
开发者ID:mdaley,项目名称:quartz-dynamodb,代码行数:22,代码来源:DynamoDbJobStore.java

示例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);
  }
}
 
开发者ID:awslabs,项目名称:emr-dynamodb-connector,代码行数:9,代码来源:DynamoDBStorageHandler.java

示例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");
}
 
开发者ID:dgks0n,项目名称:milton-aws,代码行数:29,代码来源:DynamoDBServiceImpl.java

示例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");
}
 
开发者ID:apache,项目名称:gora,代码行数:33,代码来源:DynamoDBUtils.java

示例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");
}
 
开发者ID:awslabs,项目名称:aws-dynamodb-examples,代码行数:34,代码来源:DynamoDBDynamicFaultInjection.java

示例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");
}
 
开发者ID:dselman,项目名称:tweetamo,代码行数:29,代码来源:PersistentStore.java


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