diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/NettyRpcDuplexHandler.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/NettyRpcDuplexHandler.java index 2a2df8a7ad4..f31e3d21aab 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/NettyRpcDuplexHandler.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/NettyRpcDuplexHandler.java @@ -150,9 +150,9 @@ class NettyRpcDuplexHandler extends ChannelDuplexHandler { // to return a response. There is nothing we can do w/ the response at this stage. Clean // out the wire of the response so its out of the way and we can get other responses on // this connection. - int readSoFar = IPCUtil.getTotalSizeWhenWrittenDelimited(responseHeader); - int whatIsLeftToRead = totalSize - readSoFar; if (LOG.isDebugEnabled()) { + int readSoFar = IPCUtil.getTotalSizeWhenWrittenDelimited(responseHeader); + int whatIsLeftToRead = totalSize - readSoFar; LOG.debug("Unknown callId: " + id + ", skipping over this response of " + whatIsLeftToRead + " bytes"); } diff --git a/hbase-common/src/main/java/org/apache/hadoop/hbase/ChoreService.java b/hbase-common/src/main/java/org/apache/hadoop/hbase/ChoreService.java index 5bd67ad02ee..9540d848d60 100644 --- a/hbase-common/src/main/java/org/apache/hadoop/hbase/ChoreService.java +++ b/hbase-common/src/main/java/org/apache/hadoop/hbase/ChoreService.java @@ -403,6 +403,9 @@ public class ChoreService { * Prints a summary of important details about the chore. Used for debugging purposes */ private void printChoreDetails(final String header, ScheduledChore chore) { + if (!LOG.isTraceEnabled()) { + return; + } LinkedHashMap output = new LinkedHashMap<>(); output.put(header, ""); output.put("Chore name: ", chore.getName()); @@ -410,7 +413,7 @@ public class ChoreService { output.put("Chore timeBetweenRuns: ", Long.toString(chore.getTimeBetweenRuns())); for (Entry entry : output.entrySet()) { - if (LOG.isTraceEnabled()) LOG.trace(entry.getKey() + entry.getValue()); + LOG.trace(entry.getKey() + entry.getValue()); } } @@ -418,6 +421,9 @@ public class ChoreService { * Prints a summary of important details about the service. Used for debugging purposes */ private void printChoreServiceDetails(final String header) { + if (!LOG.isTraceEnabled()) { + return; + } LinkedHashMap output = new LinkedHashMap<>(); output.put(header, ""); output.put("ChoreService corePoolSize: ", Integer.toString(getCorePoolSize())); @@ -426,7 +432,7 @@ public class ChoreService { Integer.toString(getNumberOfChoresMissingStartTime())); for (Entry entry : output.entrySet()) { - if (LOG.isTraceEnabled()) LOG.trace(entry.getKey() + entry.getValue()); + LOG.trace(entry.getKey() + entry.getValue()); } } }