@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()); } }
result = result && getRaftNettyServerReplyCase().equals( other.getRaftNettyServerReplyCase()); if (!result) return false; switch (raftNettyServerReplyCase_) {
public Builder mergeFrom(org.apache.ratis.proto.netty.NettyProtos.RaftNettyServerReplyProto other) { if (other == org.apache.ratis.proto.netty.NettyProtos.RaftNettyServerReplyProto.getDefaultInstance()) return this; switch (other.getRaftNettyServerReplyCase()) { case REQUESTVOTEREPLY: { mergeRequestVoteReply(other.getRequestVoteReply());