Skip to content

Commit 2d8966f

Browse files
committed
Initial changes
1 parent a6cd36a commit 2d8966f

File tree

4 files changed

+24
-24
lines changed

4 files changed

+24
-24
lines changed

services/sqs/src/main/java/software/amazon/awssdk/services/sqs/batchmanager/BatchOverrideConfiguration.java

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public final class BatchOverrideConfiguration implements ToCopyableBuilder<Batch
3737
private final Integer maxBatchItems;
3838
private final Integer maxBatchKeys;
3939
private final Integer maxBufferSize;
40-
private final Duration maxBatchOpenDuration;
40+
private final Duration batchSendRequestFrequency;
4141
private final Duration visibilityTimeout;
4242
private final Duration longPollWaitTimeout;
4343
private final Duration minReceiveWaitTime;
@@ -51,7 +51,7 @@ private BatchOverrideConfiguration(Builder builder) {
5151
this.maxBatchItems = Validate.isPositiveOrNull(builder.maxBatchItems, "maxBatchItems");
5252
this.maxBatchKeys = Validate.isPositiveOrNull(builder.maxBatchKeys, "maxBatchKeys");
5353
this.maxBufferSize = Validate.isPositiveOrNull(builder.maxBufferSize, "maxBufferSize");
54-
this.maxBatchOpenDuration = Validate.isPositiveOrNull(builder.maxBatchOpenDuration, "maxBatchOpenDuration");
54+
this.batchSendRequestFrequency = Validate.isPositiveOrNull(builder.batchSendRequestFrequency, "batchSendRequestFrequency");
5555
this.visibilityTimeout = Validate.isPositiveOrNull(builder.visibilityTimeout, "visibilityTimeout");
5656
this.longPollWaitTimeout = Validate.isPositiveOrNull(builder.longPollWaitTimeout, "longPollWaitTimeout");
5757
this.minReceiveWaitTime = Validate.isPositiveOrNull(builder.minReceiveWaitTime, "minReceiveWaitTime");
@@ -94,8 +94,8 @@ public Integer maxDoneReceiveBatches() {
9494
/**
9595
* @return the optional maximum amount of time that an outgoing call waits to be batched with messages of the same type.
9696
*/
97-
public Duration maxBatchOpenDuration() {
98-
return maxBatchOpenDuration;
97+
public Duration batchSendRequestFrequency() {
98+
return batchSendRequestFrequency;
9999
}
100100

101101
/**
@@ -153,7 +153,7 @@ public Builder toBuilder() {
153153
return new Builder().maxBatchItems(maxBatchItems)
154154
.maxBatchKeys(maxBatchKeys)
155155
.maxBufferSize(maxBufferSize)
156-
.maxBatchOpenDuration(maxBatchOpenDuration)
156+
.batchSendRequestFrequency(batchSendRequestFrequency)
157157
.visibilityTimeout(visibilityTimeout)
158158
.longPollWaitTimeout(longPollWaitTimeout)
159159
.minReceiveWaitTime(minReceiveWaitTime)
@@ -170,7 +170,7 @@ public String toString() {
170170
.add("maxBatchItems", maxBatchItems)
171171
.add("maxBatchKeys", maxBatchKeys)
172172
.add("maxBufferSize", maxBufferSize)
173-
.add("maxBatchOpenDuration", maxBatchOpenDuration.toMillis())
173+
.add("batchSendRequestFrequency", batchSendRequestFrequency)
174174
.add("visibilityTimeout", visibilityTimeout)
175175
.add("longPollWaitTimeout", longPollWaitTimeout)
176176
.add("minReceiveWaitTime", minReceiveWaitTime)
@@ -203,8 +203,8 @@ public boolean equals(Object o) {
203203
return false;
204204
}
205205

206-
if (maxBatchOpenDuration != null ? !maxBatchOpenDuration.equals(that.maxBatchOpenDuration) :
207-
that.maxBatchOpenDuration != null) {
206+
if (batchSendRequestFrequency != null ? !batchSendRequestFrequency.equals(that.batchSendRequestFrequency) :
207+
that.batchSendRequestFrequency != null) {
208208
return false;
209209
}
210210
if (visibilityTimeout != null ? !visibilityTimeout.equals(that.visibilityTimeout) :
@@ -244,7 +244,7 @@ public int hashCode() {
244244
int result = maxBatchItems != null ? maxBatchItems.hashCode() : 0;
245245
result = 31 * result + (maxBatchKeys != null ? maxBatchKeys.hashCode() : 0);
246246
result = 31 * result + (maxBufferSize != null ? maxBufferSize.hashCode() : 0);
247-
result = 31 * result + (maxBatchOpenDuration != null ? maxBatchOpenDuration.hashCode() : 0);
247+
result = 31 * result + (batchSendRequestFrequency != null ? batchSendRequestFrequency.hashCode() : 0);
248248
result = 31 * result + (visibilityTimeout != null ? visibilityTimeout.hashCode() : 0);
249249
result = 31 * result + (longPollWaitTimeout != null ? longPollWaitTimeout.hashCode() : 0);
250250
result = 31 * result + (minReceiveWaitTime != null ? minReceiveWaitTime.hashCode() : 0);
@@ -261,7 +261,7 @@ public static final class Builder implements CopyableBuilder<Builder, BatchOverr
261261
private Integer maxBatchItems;
262262
private Integer maxBatchKeys;
263263
private Integer maxBufferSize;
264-
private Duration maxBatchOpenDuration;
264+
private Duration batchSendRequestFrequency;
265265
private Duration visibilityTimeout;
266266
private Duration longPollWaitTimeout;
267267
private Duration minReceiveWaitTime;
@@ -315,11 +315,11 @@ public Builder maxBufferSize(Integer maxBufferSize) {
315315
* Define the maximum amount of time that an outgoing call waits for other requests before sending out a
316316
* batch request.
317317
* TODO : Decide if Ms needs to be added to the name in surface API review meeting
318-
* @param maxBatchOpenDuration The new maxBatchOpenDuration value.
318+
* @param batchSendRequestFrequency The new batchSendRequestFrequency value.
319319
* @return This object for method chaining.
320320
*/
321-
public Builder maxBatchOpenDuration(Duration maxBatchOpenDuration) {
322-
this.maxBatchOpenDuration = maxBatchOpenDuration;
321+
public Builder batchSendRequestFrequency(Duration batchSendRequestFrequency) {
322+
this.batchSendRequestFrequency = batchSendRequestFrequency;
323323
return this;
324324
}
325325

services/sqs/src/test/java/software/amazon/awssdk/services/sqs/batchmanager/BatchOverrideConfigurationTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ private static Stream<Arguments> provideConfigurations() {
6666
@MethodSource("provideConfigurations")
6767
void testBatchOverrideConfiguration(Integer maxBatchItems,
6868
Integer maxBatchKeys,
69-
Duration maxBatchOpenDuration,
69+
Duration batchSendRequestFrequency,
7070
Duration visibilityTimeout,
7171
Duration longPollWaitTimeout,
7272
Duration minReceiveWaitTime,
@@ -79,7 +79,7 @@ void testBatchOverrideConfiguration(Integer maxBatchItems,
7979
BatchOverrideConfiguration config = BatchOverrideConfiguration.builder()
8080
.maxBatchItems(maxBatchItems)
8181
.maxBatchKeys(maxBatchKeys)
82-
.maxBatchOpenDuration(maxBatchOpenDuration)
82+
.batchSendRequestFrequency(batchSendRequestFrequency)
8383
.visibilityTimeout(visibilityTimeout)
8484
.longPollWaitTimeout(longPollWaitTimeout)
8585
.minReceiveWaitTime(minReceiveWaitTime)
@@ -92,7 +92,7 @@ void testBatchOverrideConfiguration(Integer maxBatchItems,
9292

9393
assertEquals(maxBatchItems, config.maxBatchItems());
9494
assertEquals(maxBatchKeys, config.maxBatchKeys());
95-
assertEquals(maxBatchOpenDuration, config.maxBatchOpenDuration());
95+
assertEquals(batchSendRequestFrequency, config.batchSendRequestFrequency());
9696
assertEquals(visibilityTimeout, config.visibilityTimeout());
9797
assertEquals(longPollWaitTimeout, config.longPollWaitTimeout());
9898
assertEquals(minReceiveWaitTime, config.minReceiveWaitTime());
@@ -117,7 +117,7 @@ void testToBuilder() {
117117
BatchOverrideConfiguration originalConfig = BatchOverrideConfiguration.builder()
118118
.maxBatchItems(10)
119119
.maxBatchKeys(5)
120-
.maxBatchOpenDuration(Duration.ofMillis(200))
120+
.batchSendRequestFrequency(Duration.ofMillis(200))
121121
.visibilityTimeout(Duration.ofSeconds(30))
122122
.longPollWaitTimeout(Duration.ofSeconds(20))
123123
.minReceiveWaitTime(Duration.ofMillis(50))

services/sqs/src/test/java/software/amazon/awssdk/services/sqs/batchmanager/RequestBatchBufferTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class RequestBatchBufferTest {
3636
@BeforeEach
3737
void setUp() {
3838
scheduledFlush = mock(ScheduledFuture.class);
39-
batchBuffer = new RequestBatchBuffer<>(10, scheduledFlush);
39+
batchBuffer = new RequestBatchBuffer<>(scheduledFlush, );
4040
}
4141

4242
@Test
@@ -117,12 +117,12 @@ void whenExtractFlushedEntriesThenReturnCorrectEntries() {
117117
@Test
118118
void whenHasNextBatchEntryThenReturnTrue() {
119119
batchBuffer.put("request1", new CompletableFuture<>());
120-
assertTrue(batchBuffer.flushableRequests(1).containsKey("0"));
120+
assertTrue(batchBuffer.flushableRequests("request1").containsKey("0"));
121121
}
122122

123123
@Test
124124
void whenNextBatchEntryThenReturnNextEntryId() {
125125
batchBuffer.put("request1", new CompletableFuture<>());
126-
assertEquals("0", batchBuffer.flushableRequests(1).keySet().iterator().next());
126+
assertEquals("0", batchBuffer.flushableRequests("request1").keySet().iterator().next());
127127
}
128128
}

services/sqs/src/test/java/software/amazon/awssdk/services/sqs/batchmanager/RequestBatchManagerTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ void batchRequest_TwoBatchesMessagesSplitInTwoCalls_successful() throws Exceptio
8383
"testResponse"));
8484
when(mockClient.sendBatchAsync(any(), eq(batchKey1))).thenReturn(batchResponseFuture);
8585
SampleBatchManager batchManager=
86-
new SampleBatchManager(BatchOverrideConfiguration.builder().maxBatchItems(2).maxBatchOpenDuration(Duration.ofHours(1)).build(), scheduledExecutor, mockClient);
86+
new SampleBatchManager(BatchOverrideConfiguration.builder().maxBatchItems(2).batchSendRequestFrequency(Duration.ofHours(1)).build(), scheduledExecutor, mockClient);
8787
CompletableFuture<String> response1 = batchManager.batchRequest(request1);
8888
CompletableFuture<String> response2 = batchManager.batchRequest(request2);
8989
assertEquals("testResponse0", response1.get(1, TimeUnit.SECONDS));
@@ -103,7 +103,7 @@ void batchRequest_TwoBatchesWithDifferentKey_successful() throws Exception {
103103
when(mockClient.sendBatchAsync(any(), eq(KEY_TWO))).thenReturn(batchResponseFutureTwo);
104104

105105
SampleBatchManager batchManager=
106-
new SampleBatchManager(BatchOverrideConfiguration.builder().maxBatchItems(2).maxBatchOpenDuration(Duration.ofHours(1)).build(), scheduledExecutor, mockClient);
106+
new SampleBatchManager(BatchOverrideConfiguration.builder().maxBatchItems(2).batchSendRequestFrequency(Duration.ofHours(1)).build(), scheduledExecutor, mockClient);
107107
CompletableFuture<String> response1 = batchManager.batchRequest(KEY_ONE + ":0");
108108
CompletableFuture<String> response2 = batchManager.batchRequest(KEY_TWO + ":0");
109109
CompletableFuture<String> response3 = batchManager.batchRequest(KEY_ONE + ":1");
@@ -157,7 +157,7 @@ void close_FlushesAllBatches() throws Exception {
157157
when(mockClient.sendBatchAsync(any(), eq(batchKey))).thenReturn(batchResponseFuture);
158158

159159
SampleBatchManager batchManager=
160-
new SampleBatchManager(BatchOverrideConfiguration.builder().maxBatchItems(2).maxBatchOpenDuration(Duration.ofHours(1)).build(), scheduledExecutor, mockClient);
160+
new SampleBatchManager(BatchOverrideConfiguration.builder().maxBatchItems(2).batchSendRequestFrequency(Duration.ofHours(1)).build(), scheduledExecutor, mockClient);
161161

162162
CompletableFuture<String> response1 = batchManager.batchRequest(request1);
163163
CompletableFuture<String> response2 = batchManager.batchRequest(request2);
@@ -206,7 +206,7 @@ void batchRequest_MoreThanBufferSize_Fails() throws Exception {
206206
when(mockClient.sendBatchAsync(any(), eq(KEY_TWO))).thenReturn(batchResponseFutureTwo);
207207

208208
SampleBatchManager batchManager=
209-
new SampleBatchManager(BatchOverrideConfiguration.builder().maxBatchKeys(1).maxBatchItems(2).maxBatchOpenDuration(Duration.ofHours(1)).build(), scheduledExecutor, mockClient);
209+
new SampleBatchManager(BatchOverrideConfiguration.builder().maxBatchKeys(1).maxBatchItems(2).batchSendRequestFrequency(Duration.ofHours(1)).build(), scheduledExecutor, mockClient);
210210
CompletableFuture<String> response1 = batchManager.batchRequest(KEY_ONE + ":0");
211211
CompletableFuture<String> response2 = batchManager.batchRequest(KEY_TWO + ":0");
212212
CompletableFuture<String> response3 = batchManager.batchRequest(KEY_ONE + ":1");

0 commit comments

Comments
 (0)