@Override
    public long getLastLogIndex(final boolean isFlush) {
        LastLogIdClosure c;
        this.readLock.lock();
        try {
            if (!isFlush) {
                return this.lastLogIndex;
            } else {
                if (this.lastLogIndex == this.lastSnapshotId.getIndex()) {
                    return this.lastLogIndex;
                }
                c = new LastLogIdClosure();
            }
        } finally {
            this.readLock.unlock();
        }
        offerEvent(c, EventType.LAST_LOG_ID);
        try {
            c.await();
        } catch (final InterruptedException e) {
            Thread.currentThread().interrupt();
            throw new IllegalStateException(e);
        }
        if (c.lastLogId == null) {
            assert stopped : "Last log id can be null only when node is stopping.";

            throw new IllegalStateException("Node is shutting down");
        }
        return c.lastLogId.getIndex();
    }
Adds event to disk queue, NEVER call it in lock.
@param done
@param type
jraft-core/src/main/java/com/alipay/sofa/jraft/storage/impl/LogManagerImpl.java