[Code Quality] Make org.apache.rocketmq.remoting.netty.NettyRemotingAbstract#processResponseCommand more reasonable.
- Dominant language
- Java
- Stars
- 22.6k
- Forks
- 12k
- Avg merge
- 2d 20h
- Merged PRs (30d)
- 26
Description
**FEATURE REQUEST**
1. Please describe the feature you are requesting.
```
public void processResponseCommand(ChannelHandlerContext ctx, RemotingCommand cmd) {
final int opaque = cmd.getOpaque();
final ResponseFuture responseFuture = responseTable.get(opaque);
if (responseFuture != null) {
responseFuture.setResponseCommand(cmd);
responseTable.remove(opaque);
if (responseFuture.getInvokeCallback() != null) {
executeInvokeCallback(responseFuture);
} else {
responseFuture.putResponse(cmd);
responseFuture.release();
}
} else {
log.warn("receive response, but not matched any request, " + RemotingHelper.parseChannelRemoteAddr(ctx.channel()));
log.warn(cmd.toString());
}
}
```
`responseFuture.setResponseCommand(cmd);` is repeat operation with `responseFuture.putResponse(cmd);`.
Just execute in `if (responseFuture.getInvokeCallback() != null)` code block.
Contributor guide
Assessment
This issue has not been assessed yet.