public int flush() {
        if (hold()) {
            final int value = getWrotePosition();
            try {
                this.mappedByteBuffer.force();
            } catch (final Throwable e) {
                LOG.error("Error occurred when force data to disk.", e);
                throw new RuntimeException(e);
            }
            setFlushPosition(value);
            release();
        } else {
            LOG.warn("In flush, hold failed, flush offset = {}.", getFlushedPosition());
            setFlushPosition(getWrotePosition());
        }
        return getFlushedPosition();
    }
Flush data to disk
@return The current flushed position
jraft-extension/java-log-storage-impl/src/main/java/com/alipay/sofa/jraft/storage/file/AbstractFile.java