Skip to content

Commit

Permalink
use log instead NPE
Browse files Browse the repository at this point in the history
  • Loading branch information
qianye1001 committed Aug 13, 2024
1 parent fa0cd49 commit b3f7df8
Showing 1 changed file with 20 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -125,22 +125,30 @@ protected RemotingCommand unregisterClient(ChannelHandlerContext ctx, RemotingCo
final String producerGroup = requestHeader.getProducerGroup();
if (producerGroup != null) {
RemotingChannel channel = this.remotingChannelManager.removeProducerChannel(context, producerGroup, ctx.channel());
ClientChannelInfo clientChannelInfo = new ClientChannelInfo(
channel,
requestHeader.getClientID(),
request.getLanguage(),
request.getVersion());
this.messagingProcessor.unRegisterProducer(context, producerGroup, clientChannelInfo);
if (channel != null) {
ClientChannelInfo clientChannelInfo = new ClientChannelInfo(
channel,
requestHeader.getClientID(),
request.getLanguage(),
request.getVersion());
this.messagingProcessor.unRegisterProducer(context, producerGroup, clientChannelInfo);
} else {
log.warn("unregister producer failed, channel not exist, may has been removed, producerGroup={}, channel={}", producerGroup, ctx.channel());
}
}
final String consumerGroup = requestHeader.getConsumerGroup();
if (consumerGroup != null) {
RemotingChannel channel = this.remotingChannelManager.removeConsumerChannel(context, consumerGroup, ctx.channel());
ClientChannelInfo clientChannelInfo = new ClientChannelInfo(
channel,
requestHeader.getClientID(),
request.getLanguage(),
request.getVersion());
this.messagingProcessor.unRegisterConsumer(context, consumerGroup, clientChannelInfo);
if (channel != null) {
ClientChannelInfo clientChannelInfo = new ClientChannelInfo(
channel,
requestHeader.getClientID(),
request.getLanguage(),
request.getVersion());
this.messagingProcessor.unRegisterConsumer(context, consumerGroup, clientChannelInfo);
} else {
log.warn("unregister consumer failed, channel not exist, may has been removed, consumerGroup={}, channel={}", consumerGroup, ctx.channel());
}
}
response.setCode(ResponseCode.SUCCESS);
response.setRemark("");
Expand Down

0 comments on commit b3f7df8

Please sign in to comment.