private long notifyOnNewLog(final long expectedLastLogIndex, final WaitMeta wm) {
        this.writeLock.lock();
        try {
            if (expectedLastLogIndex != this.lastLogIndex || this.stopped) {
                wm.errorCode = this.stopped ? RaftError.ESTOP.getNumber() : 0;
                ThreadPoolsFactory.runInThread(this.groupId, () -> runOnNewLog(wm));
                return 0L;
            }
            long waitId = this.nextWaitId++;
            if (waitId < 0) {
            	// Valid waitId starts from 1, skip 0.
            	waitId = this.nextWaitId = 1;
            }
            this.waitMap.put(waitId, wm);
            return waitId;
        } finally {
            this.writeLock.unlock();
        }
    }
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