Skip to content

Commit c842cfe

Browse files
gyugyu90artembilan
authored andcommitted
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 7471946 commit c842cfe

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

@@ -242,7 +243,7 @@ public enum EOSMode {
242243

243244
private boolean micrometerEnabled = true;
244245

245-
private Duration consumerStartTimout = DEFAULT_CONSUMER_START_TIMEOUT;
246+
private Duration consumerStartTimeout = DEFAULT_CONSUMER_START_TIMEOUT;
246247

247248
private Boolean subBatchPerPartition;
248249

@@ -594,18 +595,28 @@ public Map<String, String> getMicrometerTags() {
594595
return Collections.unmodifiableMap(this.micrometerTags);
595596
}
596597

598+
public Duration getConsumerStartTimeout() {
599+
return this.consumerStartTimeout;
600+
}
601+
602+
@Deprecated
597603
public Duration getConsumerStartTimout() {
598-
return this.consumerStartTimout;
604+
return this.consumerStartTimeout;
599605
}
600606

601607
/**
602608
* Set the timeout to wait for a consumer thread to start before logging
603609
* an error. Default 30 seconds.
604-
* @param consumerStartTimout the consumer start timeout.
610+
* @param consumerStartTimeout the consumer start timeout.
605611
*/
606-
public void setConsumerStartTimout(Duration consumerStartTimout) {
607-
Assert.notNull(consumerStartTimout, "'consumerStartTimout' cannot be null");
608-
this.consumerStartTimout = consumerStartTimout;
612+
public void setConsumerStartTimeout(Duration consumerStartTimeout) {
613+
Assert.notNull(consumerStartTimeout, "'consumerStartTimout' cannot be null");
614+
this.consumerStartTimeout = consumerStartTimeout;
615+
}
616+
617+
@Deprecated
618+
public void setConsumerStartTimout(Duration consumerStartTimeout) {
619+
setConsumerStartTimeout(consumerStartTimeout);
609620
}
610621

611622
/**

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)