public class DatabaseInstanceStatusRetryPolicy extends Object implements org.springframework.retry.RetryPolicy
RetryPolicy implementation that checks if it is useful to retry an operation based on the database instance
status. This class retrieves that database state and verifies through the InstanceStatus enum operation if
it is useful to retry the operation. This class does not retrieve the status if there is no Throwable registered to
avoid any performance implication during normal operations.
This class should not be used alone because this would lead into a infinite retry, because this class does not
limit the amount of retries. Consider using this class together with the SqlRetryPolicy which limits the
maximum number of retries.
| Constructor and Description |
|---|
DatabaseInstanceStatusRetryPolicy(com.amazonaws.services.rds.AmazonRDS amazonRDS,
String dbInstanceIdentifier)
Constructs this strategy implementation with it default and mandatory collaborators.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
canRetry(org.springframework.retry.RetryContext context)
Implementation that checks if there is an exception registered through
registerThrowable(org.springframework.retry.RetryContext,
Throwable). |
void |
close(org.springframework.retry.RetryContext context) |
org.springframework.retry.RetryContext |
open(org.springframework.retry.RetryContext parent) |
void |
registerThrowable(org.springframework.retry.RetryContext context,
Throwable throwable) |
void |
setResourceIdResolver(org.springframework.cloud.aws.core.env.ResourceIdResolver resourceIdResolver)
Configures an option
ResourceIdResolver to resolve logical name to physical name |
public DatabaseInstanceStatusRetryPolicy(com.amazonaws.services.rds.AmazonRDS amazonRDS,
String dbInstanceIdentifier)
amazonRDS - - used to query the Amazon RDS service, must not be nulldbInstanceIdentifier - - database instance for which this class should check the state.public void setResourceIdResolver(org.springframework.cloud.aws.core.env.ResourceIdResolver resourceIdResolver)
ResourceIdResolver to resolve logical name to physical nameresourceIdResolver - - the resourceIdResolver to be used, may be nullpublic boolean canRetry(org.springframework.retry.RetryContext context)
registerThrowable(org.springframework.retry.RetryContext,
Throwable). Returns true if there is no exception registered at all and verifies the database instance status if
there is one registered.canRetry in interface org.springframework.retry.RetryPolicycontext - - the retry context which may contain a registered exceptiontrue if there is no exception registered or if there is a retry useful which is verified by the InstanceStatus enum.public org.springframework.retry.RetryContext open(org.springframework.retry.RetryContext parent)
open in interface org.springframework.retry.RetryPolicypublic void close(org.springframework.retry.RetryContext context)
close in interface org.springframework.retry.RetryPolicypublic void registerThrowable(org.springframework.retry.RetryContext context,
Throwable throwable)
registerThrowable in interface org.springframework.retry.RetryPolicyCopyright © 2016 Pivotal Software, Inc.. All rights reserved.