Skip to content

Commit adda0bf

Browse files
authored
Fix typos in ContainerProperties
The `ContainerProperties` has a `timout` typo * Fix typo in the properties names * Add new methods with the correct name * mark original methods deprecated (will be removed in the next version) * updated author list
1 parent 28d1dac commit adda0bf

File tree

3 files changed

+22
-11
lines changed

3 files changed

+22
-11
lines changed

spring-kafka/src/main/java/org/springframework/kafka/listener/ContainerProperties.java

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016-2020 the original author or authors.
2+
* Copyright 2016-2021 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -49,6 +49,7 @@
4949
* @author Artem Yakshin
5050
* @author Johnny Lim
5151
* @author Lukasz Kaminski
52+
* @author Kyuhyeok Park
5253
*/
5354
public class ContainerProperties extends ConsumerProperties {
5455

@@ -240,7 +241,7 @@ public enum EOSMode {
240241

241242
private boolean micrometerEnabled = true;
242243

243-
private Duration consumerStartTimout = DEFAULT_CONSUMER_START_TIMEOUT;
244+
private Duration consumerStartTimeout = DEFAULT_CONSUMER_START_TIMEOUT;
244245

245246
private Boolean subBatchPerPartition;
246247

@@ -559,18 +560,28 @@ public Map<String, String> getMicrometerTags() {
559560
return Collections.unmodifiableMap(this.micrometerTags);
560561
}
561562

563+
public Duration getConsumerStartTimeout() {
564+
return this.consumerStartTimeout;
565+
}
566+
567+
@Deprecated
562568
public Duration getConsumerStartTimout() {
563-
return this.consumerStartTimout;
569+
return this.consumerStartTimeout;
564570
}
565571

566572
/**
567573
* Set the timeout to wait for a consumer thread to start before logging
568574
* an error. Default 30 seconds.
569-
* @param consumerStartTimout the consumer start timeout.
575+
* @param consumerStartTimeout the consumer start timeout.
570576
*/
571-
public void setConsumerStartTimout(Duration consumerStartTimout) {
572-
Assert.notNull(consumerStartTimout, "'consumerStartTimout' cannot be null");
573-
this.consumerStartTimout = consumerStartTimout;
577+
public void setConsumerStartTimeout(Duration consumerStartTimeout) {
578+
Assert.notNull(consumerStartTimeout, "'consumerStartTimout' cannot be null");
579+
this.consumerStartTimeout = consumerStartTimeout;
580+
}
581+
582+
@Deprecated
583+
public void setConsumerStartTimout(Duration consumerStartTimeout) {
584+
setConsumerStartTimeout(consumerStartTimeout);
574585
}
575586

576587
/**

spring-kafka/src/main/java/org/springframework/kafka/listener/KafkaMessageListenerContainer.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016-2020 the original author or authors.
2+
* Copyright 2016-2021 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -309,7 +309,7 @@ protected void doStart() {
309309
.getConsumerTaskExecutor()
310310
.submitListenable(this.listenerConsumer);
311311
try {
312-
if (!this.startLatch.await(containerProperties.getConsumerStartTimout().toMillis(), TimeUnit.MILLISECONDS)) {
312+
if (!this.startLatch.await(containerProperties.getConsumerStartTimeout().toMillis(), TimeUnit.MILLISECONDS)) {
313313
this.logger.error("Consumer thread failed to start - does the configured task executor "
314314
+ "have enough threads to support all containers and concurrency?");
315315
publishConsumerFailedToStart();

spring-kafka/src/test/java/org/springframework/kafka/listener/ConcurrentMessageListenerContainerMockTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2019-2020 the original author or authors.
2+
* Copyright 2019-2021 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -98,7 +98,7 @@ void testThreadStarvation() throws InterruptedException {
9898
exec.setCorePoolSize(1);
9999
exec.afterPropertiesSet();
100100
containerProperties.setConsumerTaskExecutor(exec);
101-
containerProperties.setConsumerStartTimout(Duration.ofMillis(50));
101+
containerProperties.setConsumerStartTimeout(Duration.ofMillis(50));
102102
ConcurrentMessageListenerContainer container = new ConcurrentMessageListenerContainer<>(consumerFactory,
103103
containerProperties);
104104
container.setConcurrency(2);

0 commit comments

Comments
 (0)