Remove useless doAfterRpcFailure method in RPCHook (#4538)

This commit is contained in:
rongtong
2022-07-01 10:03:57 +08:00
committed by GitHub
parent 05fee0d773
commit 940d8d8255
7 changed files with 5 additions and 40 deletions
@@ -56,10 +56,6 @@ public class AclClientRPCHook implements RPCHook {
}
@Override public void doAfterRpcFailure(String remoteAddr, RemotingCommand request, Boolean remoteTimeout) {
}
protected SortedMap<String, String> parseRequestContent(RemotingCommand request, String ak, String securityToken) {
CommandCustomHeader header = request.readCustomHeader();
// Sort property
@@ -882,10 +882,6 @@ public class BrokerController {
public void doAfterResponse(String remoteAddr, RemotingCommand request, RemotingCommand response) {
}
@Override
public void doAfterRpcFailure(String remoteAddr, RemotingCommand request, Boolean remoteTimeout) {
}
});
}
}
@@ -381,7 +381,7 @@ public class MQClientAPIImpl implements NameServerUpdateCallback {
public void createPlainAccessConfig(final String addr, final PlainAccessConfig plainAccessConfig,
final long timeoutMillis)
throws RemotingException, MQBrokerException, InterruptedException, MQClientException {
throws RemotingException, InterruptedException, MQClientException {
CreateAccessConfigRequestHeader requestHeader = new CreateAccessConfigRequestHeader();
requestHeader.setAccessKey(plainAccessConfig.getAccessKey());
requestHeader.setSecretKey(plainAccessConfig.getSecretKey());
@@ -409,7 +409,7 @@ public class MQClientAPIImpl implements NameServerUpdateCallback {
}
public void deleteAccessConfig(final String addr, final String accessKey, final long timeoutMillis)
throws RemotingException, MQBrokerException, InterruptedException, MQClientException {
throws RemotingException, InterruptedException, MQClientException {
DeleteAccessConfigRequestHeader requestHeader = new DeleteAccessConfigRequestHeader();
requestHeader.setAccessKey(accessKey);
@@ -430,7 +430,7 @@ public class MQClientAPIImpl implements NameServerUpdateCallback {
}
public void updateGlobalWhiteAddrsConfig(final String addr, final String globalWhiteAddrs, final long timeoutMillis)
throws RemotingException, MQBrokerException, InterruptedException, MQClientException {
throws RemotingException, InterruptedException, MQClientException {
UpdateGlobalWhiteAddrsConfigRequestHeader requestHeader = new UpdateGlobalWhiteAddrsConfigRequestHeader();
requestHeader.setGlobalWhiteAddrs(globalWhiteAddrs);
@@ -485,7 +485,7 @@ public class MQClientAPIImpl implements NameServerUpdateCallback {
}
public AclConfig getBrokerClusterConfig(final String addr,
final long timeoutMillis) throws RemotingCommandException, InterruptedException, RemotingTimeoutException,
final long timeoutMillis) throws InterruptedException, RemotingTimeoutException,
RemotingSendRequestException, RemotingConnectException, MQBrokerException {
RemotingCommand request = RemotingCommand.createRequestCommand(RequestCode.GET_BROKER_CLUSTER_ACL_CONFIG, null);
@@ -600,12 +600,7 @@ public class MQClientAPIImpl implements NameServerUpdateCallback {
if (this.remotingClient instanceof NettyRemotingClient) {
NettyRemotingClient remotingClient = (NettyRemotingClient) this.remotingClient;
RemotingCommand response = responseFuture.getResponseCommand();
if (response == null) {
remotingClient.doAfterRpcFailure(RemotingHelper.parseChannelRemoteAddr(responseFuture.getChannel()), responseFuture.getRequestCommand(),
responseFuture.isTimeout());
} else {
remotingClient.doAfterRpcHooks(RemotingHelper.parseChannelRemoteAddr(responseFuture.getChannel()), responseFuture.getRequestCommand(), response);
}
remotingClient.doAfterRpcHooks(RemotingHelper.parseChannelRemoteAddr(responseFuture.getChannel()), responseFuture.getRequestCommand(), response);
}
}
@@ -24,6 +24,4 @@ public interface RPCHook {
void doAfterResponse(final String remoteAddr, final RemotingCommand request,
final RemotingCommand response);
void doAfterRpcFailure(final String remoteAddr, RemotingCommand request, Boolean remoteTimeout);
}
@@ -182,14 +182,6 @@ public abstract class NettyRemotingAbstract {
}
}
public void doAfterRpcFailure(String addr, RemotingCommand request, Boolean remoteTimeout) {
if (rpcHooks.size() > 0) {
for (RPCHook rpcHook : rpcHooks) {
rpcHook.doAfterRpcFailure(addr, request, remoteTimeout);
}
}
}
/**
* Process incoming request command issued by remote peer.
*
@@ -495,10 +487,6 @@ public abstract class NettyRemotingAbstract {
throw new RemotingSendRequestException(RemotingHelper.parseChannelRemoteAddr(channel), e);
}
} else {
if (this instanceof NettyRemotingClient) {
NettyRemotingClient nettyRemotingClient = (NettyRemotingClient) this;
nettyRemotingClient.doAfterRpcFailure(RemotingHelper.parseChannelRemoteAddr(channel), request, false);
}
if (timeoutMillis <= 0) {
throw new RemotingTooMuchRequestException("invokeAsyncImpl invoke too fast");
} else {
@@ -468,7 +468,6 @@ public class NettyRemotingClient extends NettyRemotingAbstract implements Remoti
return response;
} catch (RemotingSendRequestException e) {
LOGGER.warn("invokeSync: send request exception, so close the channel[{}]", addr);
doAfterRpcFailure(addr, request, false);
this.closeChannel(addr, channel);
throw e;
} catch (RemotingTimeoutException e) {
@@ -476,7 +475,6 @@ public class NettyRemotingClient extends NettyRemotingAbstract implements Remoti
this.closeChannel(addr, channel);
LOGGER.warn("invokeSync: close socket because of timeout, {}ms, {}", timeoutMillis, addr);
}
doAfterRpcFailure(addr, request, true);
LOGGER.warn("invokeSync: wait response timeout exception, the channel[{}]", addr);
throw e;
}
@@ -686,7 +684,6 @@ public class NettyRemotingClient extends NettyRemotingAbstract implements Remoti
this.invokeOnewayImpl(channel, request, timeoutMillis);
} catch (RemotingSendRequestException e) {
LOGGER.warn("invokeOneway: send request exception, so close the channel[{}]", addr);
doAfterRpcFailure(addr, request, false);
this.closeChannel(addr, channel);
throw e;
}
@@ -68,11 +68,6 @@ public class BrokerFailoverIT extends ContainerIntegrationTestBase {
RemotingCommand response) {
}
@Override
public void doAfterRpcFailure(String remoteAddr, RemotingCommand request, Boolean remoteTimeout) {
}
});
InnerSalveBrokerController finalTargetSlave = targetSlave;