mirror of
https://github.com/apache/rocketmq.git
synced 2026-09-01 15:47:01 +08:00
[ISSUE #7833] Fix invokeImpl() in RemotingAbstract
This commit is contained in:
+1
-7
@@ -496,13 +496,7 @@ public abstract class NettyRemotingAbstract {
|
||||
|
||||
public CompletableFuture<ResponseFuture> invokeImpl(final Channel channel, final RemotingCommand request,
|
||||
final long timeoutMillis) {
|
||||
String channelRemoteAddr = RemotingHelper.parseChannelRemoteAddr(channel);
|
||||
doBeforeRpcHooks(channelRemoteAddr, request);
|
||||
return invoke0(channel, request, timeoutMillis).whenComplete((v, t) -> {
|
||||
if (t == null) {
|
||||
doAfterRpcHooks(channelRemoteAddr, request, v.getResponseCommand());
|
||||
}
|
||||
});
|
||||
return invoke0(channel, request, timeoutMillis);
|
||||
}
|
||||
|
||||
protected CompletableFuture<ResponseFuture> invoke0(final Channel channel, final RemotingCommand request,
|
||||
|
||||
@@ -804,6 +804,9 @@ public class NettyRemotingClient extends NettyRemotingAbstract implements Remoti
|
||||
public CompletableFuture<ResponseFuture> invokeImpl(final Channel channel, final RemotingCommand request,
|
||||
final long timeoutMillis) {
|
||||
Stopwatch stopwatch = Stopwatch.createStarted();
|
||||
String channelRemoteAddr = RemotingHelper.parseChannelRemoteAddr(channel);
|
||||
doBeforeRpcHooks(channelRemoteAddr, request);
|
||||
|
||||
return super.invokeImpl(channel, request, timeoutMillis).thenCompose(responseFuture -> {
|
||||
RemotingCommand response = responseFuture.getResponseCommand();
|
||||
if (response.getCode() == ResponseCode.GO_AWAY) {
|
||||
@@ -839,6 +842,10 @@ public class NettyRemotingClient extends NettyRemotingAbstract implements Remoti
|
||||
}
|
||||
}
|
||||
return CompletableFuture.completedFuture(responseFuture);
|
||||
}).whenComplete((v, t) -> {
|
||||
if (t == null) {
|
||||
doAfterRpcHooks(channelRemoteAddr, request, v.getResponseCommand());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user