@Override
    public void close() {
        addVoterHandlerState.ifPresent(AddVoterHandlerState::close);
        addVoterHandlerState = Optional.empty();

        removeVoterHandlerState.ifPresent(RemoveVoterHandlerState::close);
        removeVoterHandlerState = Optional.empty();

        accumulator.close();
    }
Clear observer states that have not been active for a while and are not the leader.
raft/src/main/java/org/apache/kafka/raft/LeaderState.java