-
Notifications
You must be signed in to change notification settings - Fork 8.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
optimize: support fast fail when channel disconnect after message sent for RemotingClient #7095
base: 2.x
Are you sure you want to change the base?
Conversation
@@ -193,6 +198,7 @@ public Object sendSyncRequest(Channel channel, Object msg) throws TimeoutExcepti | |||
return null; | |||
} | |||
RpcMessage rpcMessage = buildRequestMessage(msg, ProtocolConstants.MSGTYPE_RESQUEST_SYNC); | |||
channelToRequestIds.computeIfAbsent(channel, ch -> ConcurrentHashMap.newKeySet()).add(rpcMessage.getId()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should the computeIfAbsent operation be extracted method? and integrated with super.sendSync? Avoid code duplication and missing calls
@@ -222,6 +229,7 @@ public void sendAsyncRequest(Channel channel, Object msg) { | |||
public void sendAsyncResponse(String serverAddress, RpcMessage rpcMessage, Object msg) { | |||
RpcMessage rpcMsg = buildResponseMessage(rpcMessage, msg, ProtocolConstants.MSGTYPE_RESPONSE); | |||
Channel channel = clientChannelManager.acquireChannel(serverAddress); | |||
channelToRequestIds.computeIfAbsent(channel, ch -> ConcurrentHashMap.newKeySet()).add(rpcMessage.getId()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is fast-failure necessary for AsyncSend? Is there Future waiting in this case?
Ⅰ. Describe what this PR did
This PR enhances the RemotingClient by implementing a mechanism to quickly fail pending requests when a channel disconnects after a message has been sent. The key changes include:
Ⅱ. Does this pull request fix one issue?
#7058
Ⅲ. Why don't you add test cases (unit test/integration test)?
wait a moment
Ⅳ. Describe how to verify it
Ⅴ. Special notes for reviews