HBASE-25762 Improvement for some debug-logging guards (#3145)

Signed-off-by: Duo Zhang <zhangduo@apache.org>
This commit is contained in:
ZhiChen 2021-04-13 23:03:55 +08:00 committed by GitHub
parent 5910e9e2d1
commit c5b0989d22
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 4 deletions

View File

@ -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.
if (LOG.isDebugEnabled()) {
int readSoFar = IPCUtil.getTotalSizeWhenWrittenDelimited(responseHeader);
int whatIsLeftToRead = totalSize - readSoFar;
if (LOG.isDebugEnabled()) {
LOG.debug("Unknown callId: " + id + ", skipping over this response of " + whatIsLeftToRead
+ " bytes");
}

View File

@ -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<String, String> 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<String, String> 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<String, String> 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<String, String> entry : output.entrySet()) {
if (LOG.isTraceEnabled()) LOG.trace(entry.getKey() + entry.getValue());
LOG.trace(entry.getKey() + entry.getValue());
}
}
}