You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@flink.apache.org by "Fang Yong (JIRA)" <ji...@apache.org> on 2017/04/24 07:10:04 UTC

[jira] [Created] (FLINK-6366) KafkaConsumer is not closed in FlinkKafkaConsumer09

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)