private boolean allBatchesFull(Deque<ProducerBatch> deque) {
        // Only the last batch may be incomplete, so we just check that.
        ProducerBatch last = deque.peekLast();
        return last == null || last.isFull();
    }
Check if all batches in the queue are full.
clients/src/main/java/org/apache/kafka/clients/producer/internals/RecordAccumulator.java