Skip to content

Commit

Permalink
Reset ConnectionWatchdog log-prefix after connect #645
Browse files Browse the repository at this point in the history
  • Loading branch information
mp911de committed Nov 12, 2017
1 parent 7118b2f commit fc81fd5
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 13 deletions.
7 changes: 3 additions & 4 deletions src/main/java/io/lettuce/core/protocol/CommandHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -743,10 +743,9 @@ private String logPrefix() {
return logPrefix;
}

StringBuilder buffer = new StringBuilder(64);
buffer.append('[').append(ChannelLogDescriptor.logDescriptor(channel)).append(", ").append("chid=0x")
.append(Long.toHexString(commandHandlerId)).append(']');
return logPrefix = buffer.toString();
String buffer = "[" + ChannelLogDescriptor.logDescriptor(channel) + ", " + "chid=0x"
+ Long.toHexString(commandHandlerId) + ']';
return logPrefix = buffer;
}

private static long nanoTime() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ public void channelActive(ChannelHandlerContext ctx) throws Exception {

channel = ctx.channel();
reconnectScheduleTimeout = null;
logPrefix = null;
remoteAddress = channel.remoteAddress();
logPrefix = null;
logger.debug("{} channelActive()", logPrefix());
Expand Down Expand Up @@ -343,10 +344,8 @@ private String logPrefix() {
return logPrefix;
}

StringBuilder buffer = new StringBuilder(64);
buffer.append('[').append(ChannelLogDescriptor.logDescriptor(channel)).append(", last known addr=")
.append(remoteAddress).append(']');
return logPrefix = buffer.toString();
String
buffer= "[" +ChannelLogDescriptor.logDescriptor(channel)+", last known addr="+remoteAddress+']';
return logPrefix = buffer;
}

}
7 changes: 3 additions & 4 deletions src/main/java/io/lettuce/core/protocol/DefaultEndpoint.java
Original file line number Diff line number Diff line change
Expand Up @@ -686,10 +686,9 @@ protected String logPrefix() {
return logPrefix;
}

StringBuffer buffer = new StringBuffer(64);
buffer.append('[').append(ChannelLogDescriptor.logDescriptor(channel)).append(", ").append("epid=0x")
.append(Long.toHexString(endpointId)).append(']');
return logPrefix = buffer.toString();
String buffer = "[" + ChannelLogDescriptor.logDescriptor(channel) + ", " + "epid=0x" + Long.toHexString(endpointId)
+ ']';
return logPrefix = buffer;
}

private class ListenerSupport {
Expand Down

0 comments on commit fc81fd5

Please sign in to comment.