Skip to content

[Code Quality] Make org.apache.rocketmq.remoting.netty.NettyRemotingAbstract#processResponseCommand more reasonable. #2578

Open
@horizonzy

Description

@horizonzy

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions