----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/33242/#review80346 -----------------------------------------------------------
Looks good, left a few comments. KafkaConsumer suffers from this same problem. Patching that should be pretty much identical -- any chance you could extend this to cover that as well? clients/src/main/java/org/apache/kafka/clients/producer/KafkaProducer.java <https://reviews.apache.org/r/33242/#comment130187> This code is all single threaded, is the AtomicReference really necessary here? clients/src/main/java/org/apache/kafka/clients/producer/KafkaProducer.java <https://reviews.apache.org/r/33242/#comment130194> Minor, but these messages should be cleaned up -- just needs some capitalization. clients/src/main/java/org/apache/kafka/clients/producer/KafkaProducer.java <https://reviews.apache.org/r/33242/#comment130195> One idea for making this less verbose and redundant: make all of these classes implement Closeable so we can just write one utility method for trying to close something and catching the exception. - Ewen Cheslack-Postava On April 16, 2015, 5:03 p.m., Steven Wu wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/33242/ > ----------------------------------------------------------- > > (Updated April 16, 2015, 5:03 p.m.) > > > Review request for kafka. > > > Bugs: KAFKA-2121 > https://issues.apache.org/jira/browse/KAFKA-2121 > > > Repository: kafka > > > Description > ------- > > fix potential resource leak when KafkaProducer throws exception in the middle > > > Diffs > ----- > > clients/src/main/java/org/apache/kafka/clients/producer/KafkaProducer.java > b91e2c52ed0acb1faa85915097d97bafa28c413a > > clients/src/test/java/org/apache/kafka/clients/producer/KafkaProducerTest.java > PRE-CREATION > > Diff: https://reviews.apache.org/r/33242/diff/ > > > Testing > ------- > > > Thanks, > > Steven Wu > >