@Override
public ListenableFuture<Object> commitOperation(@Nonnull RaftStateContext ctx, @Nonnull byte[] operation) throws RaftException {
StateType stateType = ctx.type();
Preconditions.checkNotNull(stateType);
if (stateType.equals(FOLLOWER)) {
throw new NotLeaderException(leader.get());
} else if (stateType.equals(CANDIDATE)) {
throw new NoLeaderException();
}
return Futures.immediateCancelledFuture();
}