xref: /aosp_15_r20/external/aws-crt-java/src/main/java/software/amazon/awssdk/crt/io/StandardRetryOptions.java (revision 3c7ae9de214676c52d19f01067dc1a404272dc11)
1 /**
2  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3  * SPDX-License-Identifier: Apache-2.0.
4  */
5 
6 package software.amazon.awssdk.crt.io;
7 
8 /**
9  * Top-level configuration for http retries.
10  */
11 public class StandardRetryOptions {
12 
13     private ExponentialBackoffRetryOptions backoffRetryOptions;
14     private long initialBucketCapacity;
15 
16     /**
17      * Sets the exponential backoff configuration
18      * @param backoffRetryOptions exponential backoff configuration
19      * @return this options object
20      */
withBackoffRetryOptions(ExponentialBackoffRetryOptions backoffRetryOptions)21     public StandardRetryOptions withBackoffRetryOptions(ExponentialBackoffRetryOptions backoffRetryOptions) {
22         this.backoffRetryOptions = backoffRetryOptions;
23         return this;
24     }
25 
26     /**
27      * @return current exponential backoff retry options
28      */
getBackoffRetryOptions()29     public ExponentialBackoffRetryOptions getBackoffRetryOptions() {
30         return this.backoffRetryOptions;
31     }
32 
33     /**
34      * Sets the initial capacity of the token bucket in the standard retry strategy
35      * @param initialBucketCapacity initial token bucket capacity
36      * @return this options object
37      */
withInitialBucketCapacity(long initialBucketCapacity)38     public StandardRetryOptions withInitialBucketCapacity(long initialBucketCapacity) {
39         this.initialBucketCapacity = initialBucketCapacity;
40         return this;
41     }
42 
43     /**
44      * @return current initial bucket capacity
45      */
getInitialBucketCapacity()46     public long getInitialBucketCapacity() {
47         return this.initialBucketCapacity;
48     }
49 }
50