diff --git a/src/main/java/io/lettuce/core/protocol/CommandHandler.java b/src/main/java/io/lettuce/core/protocol/CommandHandler.java index 289c2d2a57..fec2ab017b 100644 --- a/src/main/java/io/lettuce/core/protocol/CommandHandler.java +++ b/src/main/java/io/lettuce/core/protocol/CommandHandler.java @@ -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() { diff --git a/src/main/java/io/lettuce/core/protocol/ConnectionWatchdog.java b/src/main/java/io/lettuce/core/protocol/ConnectionWatchdog.java index a6b44ad569..2f3f5734b2 100644 --- a/src/main/java/io/lettuce/core/protocol/ConnectionWatchdog.java +++ b/src/main/java/io/lettuce/core/protocol/ConnectionWatchdog.java @@ -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()); @@ -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; } - } diff --git a/src/main/java/io/lettuce/core/protocol/DefaultEndpoint.java b/src/main/java/io/lettuce/core/protocol/DefaultEndpoint.java index 4989e5a9a6..c5513927fe 100644 --- a/src/main/java/io/lettuce/core/protocol/DefaultEndpoint.java +++ b/src/main/java/io/lettuce/core/protocol/DefaultEndpoint.java @@ -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 {