Skip to content

NettyRemotingAbstract.invokeAsyncImpl() a suggestion about callback ResponseFuture #2251

@17683908932

Description

@17683908932

channel.writeAndFlush(request).addListener(new ChannelFutureListener() {
@OverRide
public void operationComplete(ChannelFuture f) throws Exception {
if (f.isSuccess()) {
responseFuture.setSendRequestOK(true);
return;
}
requestFail(opaque);
log.warn("send a request command to channel <{}> failed.", RemotingHelper.parseChannelRemoteAddr(channel));
}
});

question: the method scanResponseTable() has been callback the responseFuture before f.isSuccess(), scanResponseTable() think the responseFuture is error or timeout, but responseFuture is success.

suggestion: like requestFail(). from responseTable get it

if (f.isSuccess()) {
responseFuture.setSendRequestOK(true);
return;
}
replace::
if(f.isSuccess()) {
ResponseFuture responseFuture = responseTable.get(opaque);
if (responseFuture != null) {
responseFuture.setSendRequestOK(true);
}
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions