public void produce(final List<ChangeEvent<SourceRecord, SourceRecord>> element)
            throws InterruptedException {

        checkNotNull(element);

        synchronized (lock) {
            while (next != null && !wakeupProducer) {
                lock.wait();
            }

            wakeupProducer = false;

            // an error marks this as closed for the producer
            if (error != null) {
                ExceptionUtils.rethrow(error, error.getMessage());
            } else {
                // if there is no error, then this is open and can accept this element
                next = element;
                lock.notifyAll();
            }
        }
    }
Hands over an element from the producer. If the Handover already has an element that was not
yet picked up by the consumer thread, this call blocks until the consumer picks up that
previous element.

<p>This behavior is similar to a "size one" blocking queue.</p>

@param element The next element to hand over.
@throws InterruptedException Thrown, if the thread is interrupted while blocking for the
    Handover to be empty.
inlong-sort/sort-flink/sort-flink-v1.13/sort-connectors/mongodb-cdc/src/main/java/org/apache/inlong/sort/cdc/mongodb/debezium/internal/Handover.java