StickyPartitionInfo peekCurrentPartitionInfo(Cluster cluster) {
        StickyPartitionInfo partitionInfo = stickyPartitionInfo.get();
        if (partitionInfo != null)
            return partitionInfo;

        // We're the first to create it.
        partitionInfo = new StickyPartitionInfo(nextPartition(cluster));
        if (stickyPartitionInfo.compareAndSet(null, partitionInfo))
            return partitionInfo;

        // Someone has raced us.
        return stickyPartitionInfo.get();
    }
Peek currently chosen sticky partition.  This method works in conjunction with {@link #isPartitionChanged}
and {@link #updatePartitionInfo}.  The workflow is the following:

1. peekCurrentPartitionInfo is called to know which partition to lock.
2. Lock partition's batch queue.
3. isPartitionChanged under lock to make sure that nobody raced us.
4. Append data to buffer.
5. updatePartitionInfo to update produced bytes and maybe switch partition.

 It's important that steps 3-5 are under partition's batch queue lock.

@param cluster The cluster information (needed if there is no current partition)
@return sticky partition info object
clients/src/main/java/org/apache/kafka/clients/producer/internals/BuiltInPartitioner.java