Fang Yong created FLINK-6366:
--------------------------------

             Summary: 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


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)

Reply via email to