@Override
    public void onError(RaftException e) {
        super.onError(e);
        final List<StateListener> listeners = this.storeEngine.getStateListenerContainer() //
                .getStateListenerGroup(getRegionId());
        if (listeners.isEmpty()) {
            return;
        }
        this.storeEngine.getRaftStateTrigger().execute(() -> {
            for (final StateListener listener : listeners) { // iterator the listeners
                listener.onError(e);
            }
        });
    }
Rhea KV store state machine

@author jiachun.fjc
jraft-rheakv/rheakv-core/src/main/java/com/alipay/sofa/jraft/rhea/storage/KVStoreStateMachine.java