-
Notifications
You must be signed in to change notification settings - Fork 8.7k
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: refactoring rpc request method and rpc interface. #2540
Conversation
# Conflicts: # core/src/main/java/io/seata/core/rpc/netty/AbstractRpcRemoting.java
core/src/main/java/io/seata/core/rpc/DefaultServerMessageListenerImpl.java
Outdated
Show resolved
Hide resolved
core/src/main/java/io/seata/core/rpc/DefaultServerMessageListenerImpl.java
Outdated
Show resolved
Hide resolved
*/ | ||
Object sendMsgWithResponse(String serverAddress, Object msg, long timeout) throws TimeoutException; | ||
Object sendSyncRequest(Channel channel, Object msg) throws TimeoutException; |
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 there be a channel parameter?
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.
At that time, why the channel invaded the RemotingClient interface was also a helpless choice, because when called in many places, the various parameters were not uniform, it was difficult to remove the dependency of the channel. At that time, my idea was,
- RemotingClient as a top-level interface, when other rpc types are added in the future, their interfaces can be added to this top-level interface
- Remove the netty-related dependencies and make a RemotingClient that is truly irrelevant to the specific rpc type
In the end I chose the first and easiest method to refactor.
I would like to add a pr later to improve it.
core/src/main/java/io/seata/core/rpc/netty/NettyClientBootstrap.java
Outdated
Show resolved
Hide resolved
core/src/main/java/io/seata/core/rpc/netty/NettyRemotingServer.java
Outdated
Show resolved
Hide resolved
core/src/main/java/io/seata/core/rpc/processor/client/RmBranchRollbackProcessor.java
Outdated
Show resolved
Hide resolved
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.
LGTM
core/src/main/java/io/seata/core/rpc/processor/server/RegRmProcessor.java
Outdated
Show resolved
Hide resolved
core/src/main/java/io/seata/core/rpc/processor/server/RegTmProcessor.java
Outdated
Show resolved
Hide resolved
core/src/main/java/io/seata/core/rpc/netty/AbstractNettyRemotingServer.java
Show resolved
Hide resolved
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.
LGTM
Ⅰ. Describe what this PR did
this pr base on phase3:#2486
refactoring rpc request method:
(1) AbstractRemoting
Object sendSync(Channel channel, RpcMessage rpcMessage, long timeoutMillis) throws TimeoutException
void sendAsync(Channel channel, RpcMessage rpcMessage)
(2) RemotingClient
Object sendSyncRequest(Object msg) throws TimeoutException;
Object sendSyncRequest(Channel channel, Object msg) throws TimeoutException;
void sendAsyncRequest(Channel channel, Object msg);
void sendAsyncResponse(String serverAddress, RpcMessage rpcMessage, Object msg);
(3) RemotingServer
Object sendSyncRequest(String resourceId, String clientId, Object msg) throws TimeoutException;
Object sendSyncRequest(Channel channel, Object msg) throws TimeoutException;
void sendAsyncRequest(Channel channel, Object msg);
void sendAsyncResponse(RpcMessage rpcMessage, Channel channel, Object msg);
Name optimization and class classification.
remove AbstractNettyRemotingSever.
Ⅱ. Does this pull request fix one issue?
refactoring tasks: #2313
ⅡⅠ. Method call
Two fixed rpc communication methods: sendSync and sendAsync method, client and server can freely extend the request method, and finally send messages through sendSync and sendAsync method.
ⅠV. Remote service interface relationship