Search in sources :

Example 1 with WaiterOverrideConfiguration

use of software.amazon.awssdk.core.waiters.WaiterOverrideConfiguration in project aws-sdk-java-v2 by aws.

the class DefaultQueryAsyncWaiter method postOperationSuccessWaiterConfig.

private static WaiterOverrideConfiguration postOperationSuccessWaiterConfig(WaiterOverrideConfiguration overrideConfig) {
    Optional<WaiterOverrideConfiguration> optionalOverrideConfig = Optional.ofNullable(overrideConfig);
    int maxAttempts = optionalOverrideConfig.flatMap(WaiterOverrideConfiguration::maxAttempts).orElse(40);
    BackoffStrategy backoffStrategy = optionalOverrideConfig.flatMap(WaiterOverrideConfiguration::backoffStrategy).orElse(FixedDelayBackoffStrategy.create(Duration.ofSeconds(1)));
    Duration waitTimeout = optionalOverrideConfig.flatMap(WaiterOverrideConfiguration::waitTimeout).orElse(null);
    return WaiterOverrideConfiguration.builder().maxAttempts(maxAttempts).backoffStrategy(backoffStrategy).waitTimeout(waitTimeout).build();
}
Also used : BackoffStrategy(software.amazon.awssdk.core.retry.backoff.BackoffStrategy) FixedDelayBackoffStrategy(software.amazon.awssdk.core.retry.backoff.FixedDelayBackoffStrategy) Duration(java.time.Duration) WaiterOverrideConfiguration(software.amazon.awssdk.core.waiters.WaiterOverrideConfiguration)

Example 2 with WaiterOverrideConfiguration

use of software.amazon.awssdk.core.waiters.WaiterOverrideConfiguration in project aws-sdk-java-v2 by aws.

the class DefaultQueryWaiter method postOperationSuccessWaiterConfig.

private static WaiterOverrideConfiguration postOperationSuccessWaiterConfig(WaiterOverrideConfiguration overrideConfig) {
    Optional<WaiterOverrideConfiguration> optionalOverrideConfig = Optional.ofNullable(overrideConfig);
    int maxAttempts = optionalOverrideConfig.flatMap(WaiterOverrideConfiguration::maxAttempts).orElse(40);
    BackoffStrategy backoffStrategy = optionalOverrideConfig.flatMap(WaiterOverrideConfiguration::backoffStrategy).orElse(FixedDelayBackoffStrategy.create(Duration.ofSeconds(1)));
    Duration waitTimeout = optionalOverrideConfig.flatMap(WaiterOverrideConfiguration::waitTimeout).orElse(null);
    return WaiterOverrideConfiguration.builder().maxAttempts(maxAttempts).backoffStrategy(backoffStrategy).waitTimeout(waitTimeout).build();
}
Also used : BackoffStrategy(software.amazon.awssdk.core.retry.backoff.BackoffStrategy) FixedDelayBackoffStrategy(software.amazon.awssdk.core.retry.backoff.FixedDelayBackoffStrategy) Duration(java.time.Duration) WaiterOverrideConfiguration(software.amazon.awssdk.core.waiters.WaiterOverrideConfiguration)

Aggregations

Duration (java.time.Duration)2 BackoffStrategy (software.amazon.awssdk.core.retry.backoff.BackoffStrategy)2 FixedDelayBackoffStrategy (software.amazon.awssdk.core.retry.backoff.FixedDelayBackoffStrategy)2 WaiterOverrideConfiguration (software.amazon.awssdk.core.waiters.WaiterOverrideConfiguration)2