@Override protected void channelRead0(ChannelHandlerContext ctx, RaftNettyServerReplyProto proto) { final CompletableFuture<RaftNettyServerReplyProto> future = pollReply(); if (future == null) { throw new IllegalStateException("Request #" + getCallId(proto) + " not found"); } if (proto.getRaftNettyServerReplyCase() == EXCEPTIONREPLY) { final Object ioe = ProtoUtils.toObject(proto.getExceptionReply().getException()); future.completeExceptionally((IOException)ioe); } else { future.complete(proto); } } };
public static long getCallId(RaftNettyServerReplyProto proto) { switch (proto.getRaftNettyServerReplyCase()) { case REQUESTVOTEREPLY: return proto.getRequestVoteReply().getServerReply().getCallId(); case APPENDENTRIESREPLY: return proto.getAppendEntriesReply().getServerReply().getCallId(); case INSTALLSNAPSHOTREPLY: return proto.getInstallSnapshotReply().getServerReply().getCallId(); case RAFTCLIENTREPLY: return proto.getRaftClientReply().getRpcReply().getCallId(); case EXCEPTIONREPLY: return proto.getExceptionReply().getRpcReply().getCallId(); case RAFTNETTYSERVERREPLY_NOT_SET: throw new IllegalArgumentException("Reply case not set in proto: " + proto.getRaftNettyServerReplyCase()); default: throw new UnsupportedOperationException("Reply case not supported: " + proto.getRaftNettyServerReplyCase()); } }
case 7: hash = (37 * hash) + EXCEPTIONREPLY_FIELD_NUMBER; hash = (53 * hash) + getExceptionReply().hashCode(); break; case 0:
break; case 7: result = result && getExceptionReply() .equals(other.getExceptionReply()); break; case 0:
mergeExceptionReply(other.getExceptionReply()); break;