[ https://issues.apache.org/jira/browse/FLINK-6366?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Fang Yong closed FLINK-6366. ---------------------------- Resolution: Invalid As [~tzulitai] said, this change isn't necessary, as the previous implementation was a "try-with-resources" statement (see https://docs.oracle.com/javase/tutorial/essential/exceptions/tryResourceClose.html). The consumer is always closed when the try-with-resources block finishes. > KafkaConsumer is not closed in FlinkKafkaConsumer09 > --------------------------------------------------- > > Key: FLINK-6366 > URL: https://issues.apache.org/jira/browse/FLINK-6366 > Project: Flink > Issue Type: Bug > Reporter: Fang Yong > Assignee: Fang Yong > > In getKafkaPartitions of FlinkKafkaConsumer09, the KafkaConsumer is created > as flowers and will not be closed. > {code:title=FlinkKafkaConsumer09.java|borderStyle=solid} > protected List<KafkaTopicPartition> getKafkaPartitions(List<String> topics) { > // read the partitions that belong to the listed topics > final List<KafkaTopicPartition> partitions = new ArrayList<>(); > try (KafkaConsumer<byte[], byte[]> consumer = new > KafkaConsumer<>(this.properties)) { > for (final String topic: topics) { > // get partitions for each topic > List<PartitionInfo> partitionsForTopic = > consumer.partitionsFor(topic); > ... > } > } > ... > } > {code} -- This message was sent by Atlassian JIRA (v6.3.15#6346)