在 org.apache.kafka.clients.producer.internals.RecordAccumulator 类中,有如下的解释和相关逻辑:
/**
* The accumulator uses a bounded amount of memory and append calls will block when that memory is exhausted, unless
* this behavior is explicitly disabled.
*/
这段解释分析了 RecordAccumulator 利用了有限的内存,当内存耗尽时,追加操作将会阻塞,除非显式地禁用了这种举动。
BufferPool 类中的 allocate 方法