Tom Lee created KAFKA-1838: ------------------------------ Summary: Better interrupt handling in producers Key: KAFKA-1838 URL: https://issues.apache.org/jira/browse/KAFKA-1838 Project: Kafka Issue Type: Improvement Components: producer Affects Versions: 0.8.1.1 Reporter: Tom Lee Assignee: Jun Rao
Interrupting a thread where a Producer is in use can cause unexpected behavior. In the case of an async type producer, interrupting the producer thread will like lead to a QueueFullException with the default configuration (see https://github.com/apache/kafka/blob/0.8.1.1/core/src/main/scala/kafka/producer/Producer.scala#L105-L112 ) This obviously can't be safely be used in client code to determine if the thread was interrupted because the async producer's message queue may simply be backed up. It's important to be able to distinguish between interrupts vs full queues so client thread pools can be shutdown properly etc. In the case of a sync producer, there's the possibility an InterruptedException will bubble up out of Producer.send. This will likely result in an UndeclaredThrowableException in Java code -- this is more helpful than a QueueFullException, but it's still somewhat awkward. -- This message was sent by Atlassian JIRA (v6.3.4#6332)