diff --git a/src/main/java/com/lambdaworks/redis/protocol/CommandHandler.java b/src/main/java/com/lambdaworks/redis/protocol/CommandHandler.java index 92ccca4283..c93b7223cd 100644 --- a/src/main/java/com/lambdaworks/redis/protocol/CommandHandler.java +++ b/src/main/java/com/lambdaworks/redis/protocol/CommandHandler.java @@ -1150,10 +1150,9 @@ protected String logPrefix() { return logPrefix; } - StringBuffer buffer = new StringBuffer(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; } protected static List drainCommands(Queue source) { diff --git a/src/main/java/com/lambdaworks/redis/protocol/ConnectionWatchdog.java b/src/main/java/com/lambdaworks/redis/protocol/ConnectionWatchdog.java index dddcabc50f..3bd913867e 100644 --- a/src/main/java/com/lambdaworks/redis/protocol/ConnectionWatchdog.java +++ b/src/main/java/com/lambdaworks/redis/protocol/ConnectionWatchdog.java @@ -162,6 +162,7 @@ public void channelActive(ChannelHandlerContext ctx) throws Exception { } reconnectScheduleTimeout = null; + logPrefix = null; channel = ctx.channel(); remoteAddress = channel.remoteAddress(); logger.debug("{} channelActive({})", logPrefix(), ctx); @@ -348,9 +349,7 @@ 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; } }