final String indexName = getIndexName(); retry: for (;;) { final TableDescription desc = getTable().waitForActive(); List<GlobalSecondaryIndexDescription> list = desc.getGlobalSecondaryIndexes(); if (list != null) {
final String indexName = getIndexName(); retry: for (;;) { TableDescription desc = table.waitForActive(); final List<GlobalSecondaryIndexDescription> list = desc.getGlobalSecondaryIndexes(); if (list != null) {
final String indexName = getIndexName(); retry: for (;;) { TableDescription desc = table.waitForActive(); List<GlobalSecondaryIndexDescription> list = desc.getGlobalSecondaryIndexes(); if (list != null) {
/** * Wait for table being active. * @param t table to block on. * @throws IOException IO problems * @throws InterruptedIOException if the wait was interrupted * @throws IllegalArgumentException if an exception was raised in the waiter */ @Retries.RetryTranslated private void waitForTableActive(Table t) throws IOException { invoker.retry("Waiting for active state of table " + tableName, null, true, () -> { try { t.waitForActive(); } catch (IllegalArgumentException ex) { throw translateTableWaitFailure(tableName, ex); } catch (InterruptedException e) { LOG.warn("Interrupted while waiting for table {} in region {}" + " active", tableName, region, e); Thread.currentThread().interrupt(); throw (InterruptedIOException) new InterruptedIOException("DynamoDB table '" + tableName + "' is not active yet in region " + region) .initCause(e); } }); }
static void updateExampleTable() { Table table = dynamoDB.getTable(tableName); System.out.println("Modifying provisioned throughput for " + tableName); try { table.updateTable(new ProvisionedThroughput() .withReadCapacityUnits(6L).withWriteCapacityUnits(7L)); table.waitForActive(); } catch (Exception e) { System.err.println("UpdateTable request failed for " + tableName); System.err.println(e.getMessage()); } }
@Override public void clear() { Loggers.DYNAMODB_LOG.trace("[DS0123] DynamoDB store: Clearing {} items", getCacheName()); if (requestFactory.appliesRangeKey()) { throw new PersistenceException("DynamoDB clear operation not supported with applied range key"); } try { DeleteTableResult result = table.delete(); int numDeleted = result.getTableDescription().getItemCount().intValue(); Loggers.DYNAMODB_LOG.info("[DS0125] DynamoDB store: Cleared {} {} items", numDeleted, table.getTableName()); table.waitForDelete(); client.createTable(requestFactory.resolveCreateTableRequest()); table.waitForActive(); } catch (Exception e) { Loggers.DYNAMODB_LOG.error("[DS0124] {}: {}", e.getMessage(), e); throw new PersistenceException(e.getMessage(), e); } }
final String indexName = getIndexName(); retry: for (;;) { final TableDescription desc = getTable().waitForActive(); List<GlobalSecondaryIndexDescription> list = desc.getGlobalSecondaryIndexes(); if (list != null) {
final String indexName = getIndexName(); retry: for (;;) { TableDescription desc = table.waitForActive(); final List<GlobalSecondaryIndexDescription> list = desc.getGlobalSecondaryIndexes(); if (list != null) {
static void createExampleTable() { try { ArrayList<AttributeDefinition> attributeDefinitions = new ArrayList<AttributeDefinition>(); attributeDefinitions.add(new AttributeDefinition() .withAttributeName("Id") .withAttributeType("N")); ArrayList<KeySchemaElement> keySchema = new ArrayList<KeySchemaElement>(); keySchema.add(new KeySchemaElement() .withAttributeName("Id") .withKeyType(KeyType.HASH)); CreateTableRequest request = new CreateTableRequest() .withTableName(tableName) .withKeySchema(keySchema) .withAttributeDefinitions(attributeDefinitions) .withProvisionedThroughput(new ProvisionedThroughput() .withReadCapacityUnits(5L) .withWriteCapacityUnits(6L)); System.out.println("Issuing CreateTable request for " + tableName); Table table = dynamoDB.createTable(request); System.out.println("Waiting for " + tableName + " to be created...this may take a while..."); table.waitForActive(); getTableInformation(); } catch (Exception e) { System.err.println("CreateTable request failed for " + tableName); System.err.println(e.getMessage()); } }
System.out.println("Waiting for " + tableName + " to be created...this may take a while..."); table.waitForActive();
final String indexName = getIndexName(); retry: for (;;) { TableDescription desc = table.waitForActive(); List<GlobalSecondaryIndexDescription> list = desc.getGlobalSecondaryIndexes(); if (list != null) {
table.waitForActive(); LOG.info( String.format("Table %s already existed, updated R/W units of %d/%d units/sec", table.waitForActive();
table.waitForActive(); } catch (InterruptedException e) { throw new PersistenceException("Interrupted while awaiting DynamoDB table to become active: " + e.getMessage(), e);
System.out.println("Waiting for " + tableName + " to be created...this may take a while..."); table.waitForActive();
table.waitForActive(); } catch (Exception e) { LOGGER.error("Error while creating the DynamoDB table " + tableName
try { Table table = dynamoDB.getTable(tableName); table.waitForActive(); } catch (InterruptedException e) { e.printStackTrace();
public static TableDescription createTable(AmazonDynamoDB client, String tableName) throws InterruptedException { CreateTableRequest tableReq = new CreateTableRequest().withTableName(tableName) .withKeySchema(new KeySchemaElement("Id", KeyType.HASH)) .withAttributeDefinitions(new AttributeDefinition("Id", ScalarAttributeType.N)) .withProvisionedThroughput(new ProvisionedThroughput(10L, 10L)) .withStreamSpecification(new StreamSpecification().withStreamEnabled(true).withStreamViewType(StreamViewType.NEW_AND_OLD_IMAGES)); DynamoDB dynamoDB = new DynamoDB(client); Table table = dynamoDB.createTable(tableReq); return table.waitForActive(); }
public static TableDescription createTable(AmazonDynamoDB client, String tableName) throws InterruptedException { CreateTableRequest tableReq = new CreateTableRequest().withTableName(tableName) .withKeySchema(new KeySchemaElement("Id", KeyType.HASH)) .withAttributeDefinitions(new AttributeDefinition("Id", ScalarAttributeType.N)) .withProvisionedThroughput(new ProvisionedThroughput(10L, 10L)) .withStreamSpecification(new StreamSpecification().withStreamEnabled(true).withStreamViewType(StreamViewType.NEW_AND_OLD_IMAGES)); DynamoDB dynamoDB = new DynamoDB(client); Table table = dynamoDB.createTable(tableReq); return table.waitForActive(); }
try { Table table = dynamoDB.getTable(tableName); table.waitForActive(); } catch (InterruptedException e) { e.printStackTrace();