private synchronized boolean handleFinishWrite(long flushId, Throwable error, Void result) {
        // Callbacks need to be handled carefully since the flush operation may have already timed
        // out and been cancelled.
        if (flushId != currentFlushId)
            return false;

        if (error != null) {
            cancelFlush();
        } else {
            currentFlushId++;
            flushInProgress.release();
            toFlush = null;
        }
        return true;
    }
Handle completion of a write. Returns true if this callback is for the current flush
operation, false if it's for an old operation that should now be ignored.
connect/runtime/src/main/java/org/apache/kafka/connect/storage/OffsetStorageWriter.java