Skip to content

Commit

Permalink
[master] DefaultFuture turn off logging optimization for Channel(issue
Browse files Browse the repository at this point in the history
  • Loading branch information
stone-98 committed Sep 12, 2021
1 parent 05b2032 commit 2f93930
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
Expand Up @@ -137,6 +137,15 @@ public Request copy() {
return copy;
}

public Request copyWithoutData() {
Request copy = new Request(mId);
copy.mVersion = this.mVersion;
copy.mTwoWay = this.mTwoWay;
copy.mEvent = this.mEvent;
copy.mBroken = this.mBroken;
return copy;
}

@Override
public String toString() {
return "Request [id=" + mId + ", version=" + mVersion + ", twoway=" + mTwoWay + ", event=" + mEvent
Expand Down
Expand Up @@ -147,7 +147,7 @@ public static void closeChannel(Channel channel) {
disconnectResponse.setErrorMessage("Channel " +
channel +
" is inactive. Directly return the unFinished request : " +
future.getRequest());
(logger.isDebugEnabled() ? future.getRequest() : future.getRequest().copyWithoutData()));
DefaultFuture.received(channel, disconnectResponse);
}
}
Expand Down Expand Up @@ -251,15 +251,10 @@ private String getTimeoutMessage(boolean scan) {
+ (sent > 0 ? " client elapsed: " + (sent - start)
+ " ms, server elapsed: " + (nowTimestamp - sent)
: " elapsed: " + (nowTimestamp - start)) + " ms, timeout: "
+ timeout + " ms, request: " + (logger.isDebugEnabled() ? request : getRequestWithoutData()) + ", channel: " + channel.getLocalAddress()
+ timeout + " ms, request: " + (logger.isDebugEnabled() ? request : request.copyWithoutData()) + ", channel: " + channel.getLocalAddress()
+ " -> " + channel.getRemoteAddress();
}

private Request getRequestWithoutData() {
Request newRequest = request.copy();
newRequest.setData(null);
return newRequest;
}

private static class TimeoutCheckTask implements TimerTask {

Expand Down

0 comments on commit 2f93930

Please sign in to comment.