in src/main/java/com/amazonaws/services/dynamodbv2/streamsadapter/DynamoDBStreamsProxy.java [152:191]
public DescribeStreamResult getStreamInfo(String startShardId)
throws ResourceNotFoundException, LimitExceededException {
final DescribeStreamRequest describeStreamRequest = new DescribeStreamRequest();
describeStreamRequest.setRequestCredentials(credentialsProvider.getCredentials());
describeStreamRequest.setStreamName(streamName);
describeStreamRequest.setExclusiveStartShardId(startShardId);
DescribeStreamResult response = null;
LimitExceededException lastException = null;
int remainingRetryTimes = this.maxDescribeStreamRetryAttempts;
// Call DescribeStream, with backoff and retries (if we get LimitExceededException).
while (response == null) {
try {
response = client.describeStream(describeStreamRequest);
} catch (LimitExceededException le) {
LOG.info("Got LimitExceededException when describing stream " + streamName + ". Backing off for "
+ this.describeStreamBackoffTimeInMillis + " millis.");
sleeper.sleep(this.describeStreamBackoffTimeInMillis);
lastException = le;
}
remainingRetryTimes--;
if (remainingRetryTimes == 0 && response == null) {
if (lastException != null) {
throw lastException;
}
throw new IllegalStateException("Received null from DescribeStream call.");
}
}
final String streamStatus = response.getStreamDescription().getStreamStatus();
if (StreamStatus.ACTIVE.toString().equals(streamStatus)
|| StreamStatus.UPDATING.toString().equals(streamStatus)) {
return response;
} else {
LOG.info("Stream is in status " + streamStatus
+ ", DescribeStream returning null (wait until stream is Active or Updating");
return null;
}
}