You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "Manyanda Chitimbo (Jira)" <ji...@apache.org> on 2023/06/15 10:28:00 UTC

[jira] [Commented] (KAFKA-9400) Make Consumer Class Extend AutoCloseable

    [ https://issues.apache.org/jira/browse/KAFKA-9400?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17732983#comment-17732983 ] 

Manyanda Chitimbo commented on KAFKA-9400:
------------------------------------------

The Consumer.java interface extends Closeable.java interface:[ https://github.com/apache/kafka/blob/505e8240cd29fe3f0effa96d794bc711d5c8423b/clients/src/main/java/org/apache/kafka/clients/consumer/Consumer.java#L37|https://github.com/apache/kafka/blob/505e8240cd29fe3f0effa96d794bc711d5c8423b/clients/src/main/java/org/apache/kafka/clients/consumer/Consumer.java#L37]

The Closeable interface already extends the AutoCloseable.java interface see [https://docs.oracle.com/javase/8/docs/api/java/io/Closeable.html] 
 
I think this issue can be closed as already resolved. What do you think? [~belugabehr] 

> Make Consumer Class Extend AutoCloseable
> ----------------------------------------
>
>                 Key: KAFKA-9400
>                 URL: https://issues.apache.org/jira/browse/KAFKA-9400
>             Project: Kafka
>          Issue Type: Improvement
>            Reporter: David Mollitor
>            Priority: Minor
>
> {quote}
>  The consumer maintains TCP connections to the necessary brokers to fetch data.
>  Failure to close the consumer after use will leak these connections.
> {quote}
> https://github.com/apache/kafka/blob/505e8240cd29fe3f0effa96d794bc711d5c8423b/clients/src/main/java/org/apache/kafka/clients/consumer/KafkaConsumer.java#L92-L94
> To assist in making sure that consumers are closed, please have the Consumer interface extend AutoCloseable.
> https://docs.oracle.com/javase/8/docs/api/java/lang/AutoCloseable.html



--
This message was sent by Atlassian Jira
(v8.20.10#820010)