KIP-376 — Implement AutoClosable on appropriate classes that want to be used in a try-with-resource statement
Accepted Kafka 2.2 Client
KIP-376 makes `KafkaStreams`, `KafkaChannel`, `ConsumerInterceptor`, `MetricsReporter`, and several other Kafka and Streams components implement `java.lang.AutoCloseable` so they can be used in try-with-resources blocks. These classes hold resources and have `close()` methods but did not implement the interface, preventing resource-safe usage patterns and complicating test teardown.
Details
| Author | Yishun Guan |
| Status | Accepted |
| Kafka Version | 2.2 |
| JIRA | KAFKA-7402 |
| Wiki | View on Apache Wiki |
| Created | 2018-09-25 |
| Last Modified | 2018-11-17 |
Explore how this KIP affects the Kafka protocol in the Protocol Explorer, or see the full KIP database.