I am checking out the source code of 0.8.2 producer code. I have two
questions and hope to get some clarifications.

1) Sender thread/Runnable has this run loop. what if the in-memory queue is
mostly empty (i.e. producer has very few msgs to send out)? will this
become a simple tight loop that just wastes cpu?

        // main loop, runs until close is called
        while (running) {
            try {
                run(time.milliseconds());
            } catch (Exception e) {
                log.error("Uncaught error in kafka producer I/O thread: ",
e);
            }
        }

2) Selector#poll()  [line #200]

            if (transmissions.hasSend())
                throw new IllegalStateException("Attempt to begin a send
operation with prior send operation still in progress.");

2.1) since it's aysnc API, back-to-back sends to the same broker seem very
possible to me. should we throw an exception here?
2.2) if this happens, it seems that we will silently drop the msgs without
executing callbacks?


Thanks,
Steven

Reply via email to