You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kafka.apache.org by jg...@apache.org on 2018/10/05 19:00:12 UTC
[kafka] 01/02: MINOR: Ensure consumers are closed in
DynamicBrokerReconfigurationTest (#5750)
This is an automated email from the ASF dual-hosted git repository.
jgus pushed a commit to branch 2.1
in repository https://gitbox.apache.org/repos/asf/kafka.git
commit 3a0259aa916bb69399712e246ac311dcc04fcadd
Author: Jason Gustafson <ja...@confluent.io>
AuthorDate: Fri Oct 5 11:31:05 2018 -0700
MINOR: Ensure consumers are closed in DynamicBrokerReconfigurationTest (#5750)
In `ConsumerBuilder.build`, if `awaitInitialPositions` raises an exception, the consumer will not be closed properly. We should add the consumer instance to the `consumers` collection immediately after construction.
Reviewers: Guozhang Wang <wa...@gmail.com>
---
.../integration/kafka/server/DynamicBrokerReconfigurationTest.scala | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/core/src/test/scala/integration/kafka/server/DynamicBrokerReconfigurationTest.scala b/core/src/test/scala/integration/kafka/server/DynamicBrokerReconfigurationTest.scala
index 5d15cc4..ff4ccef 100644
--- a/core/src/test/scala/integration/kafka/server/DynamicBrokerReconfigurationTest.scala
+++ b/core/src/test/scala/integration/kafka/server/DynamicBrokerReconfigurationTest.scala
@@ -1419,10 +1419,11 @@ class DynamicBrokerReconfigurationTest extends ZooKeeperTestHarness with SaslSet
consumerProps.put(ConsumerConfig.ENABLE_AUTO_COMMIT_CONFIG, _enableAutoCommit.toString)
val consumer = new KafkaConsumer[String, String](consumerProps, new StringDeserializer, new StringDeserializer)
+ consumers += consumer
+
consumer.subscribe(Collections.singleton(_topic))
if (_autoOffsetReset == "latest")
awaitInitialPositions(consumer)
- consumers += consumer
consumer
}
}