From ce4a8fe24ecfc62243451d88afaaf8812c6ae8ed Mon Sep 17 00:00:00 2001 From: 0xb00bface <0xboobface@gmail.com> Date: Sat, 23 Jan 2021 17:00:47 +0100 Subject: [PATCH] Add if state ments to conditionally execute log.trace --- .../src/main/java/ctbrec/recorder/ThreadPoolScaler.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/common/src/main/java/ctbrec/recorder/ThreadPoolScaler.java b/common/src/main/java/ctbrec/recorder/ThreadPoolScaler.java index 2f49c5ee..1f3ca071 100644 --- a/common/src/main/java/ctbrec/recorder/ThreadPoolScaler.java +++ b/common/src/main/java/ctbrec/recorder/ThreadPoolScaler.java @@ -36,7 +36,9 @@ public class ThreadPoolScaler { if (average > 0.65 * coreSize) { threadPool.setCorePoolSize(coreSize + 1); downScaleCoolDown = now.plusSeconds(30); - LOG.trace("Adjusted scheduler pool size to {}", threadPool.getCorePoolSize()); + if (LOG.isTraceEnabled()) { + LOG.trace("Adjusted scheduler pool size to {}", threadPool.getCorePoolSize()); + } } else if (average < 0.15 * coreSize) { int newValue = Math.max(configuredPoolSize, coreSize - 1); if (threadPool.getCorePoolSize() != newValue && now.isAfter(downScaleCoolDown)) { @@ -46,7 +48,9 @@ public class ThreadPoolScaler { } } lastAdjustment = now; - LOG.trace("Thread pool size is {}", threadPool.getCorePoolSize()); + if (LOG.isTraceEnabled()) { + LOG.trace("Thread pool size is {}", threadPool.getCorePoolSize()); + } } }