Skip to content

Commit 9ed24f2

Browse files
committed
Reduce debug logging verbosity
1 parent 060b564 commit 9ed24f2

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

client/src/main/java/org/asynchttpclient/netty/channel/DefaultChannelPool.java

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,11 @@ private List<IdleChannel> expiredChannels(ConcurrentLinkedDeque<IdleChannel> par
154154
// lazy create
155155
List<IdleChannel> idleTimeoutChannels = null;
156156
for (IdleChannel idleChannel : partition) {
157-
if (isIdleTimeoutExpired(idleChannel, now) || isRemotelyClosed(idleChannel.channel) || isTtlExpired(idleChannel.channel, now)) {
158-
LOGGER.debug("Adding Candidate expired Channel {}", idleChannel.channel);
157+
boolean isIdleTimeoutExpired = isIdleTimeoutExpired(idleChannel, now);
158+
boolean isRemotelyClosed = isRemotelyClosed(idleChannel.channel);
159+
boolean isTtlExpired = isTtlExpired(idleChannel.channel, now);
160+
if (isIdleTimeoutExpired || isRemotelyClosed || isTtlExpired) {
161+
LOGGER.debug("Adding Candidate expired Channel {} isIdleTimeoutExpired={} isRemotelyClosed={} isTtlExpired={}", idleChannel.channel, isIdleTimeoutExpired, isRemotelyClosed, isTtlExpired);
159162
if (idleTimeoutChannels == null)
160163
idleTimeoutChannels = new ArrayList<>(1);
161164
idleTimeoutChannels.add(idleChannel);
@@ -199,7 +202,10 @@ public void run(Timeout timeout) throws Exception {
199202

200203
if (LOGGER.isDebugEnabled())
201204
for (Object key : partitions.keySet()) {
202-
LOGGER.debug("Entry count for : {} : {}", key, partitions.get(key).size());
205+
int size = partitions.get(key).size();
206+
if (size > 0) {
207+
LOGGER.debug("Entry count for : {} : {}", key, size);
208+
}
203209
}
204210

205211
long start = unpreciseMillisTime();
@@ -228,7 +234,9 @@ public void run(Timeout timeout) throws Exception {
228234

229235
if (LOGGER.isDebugEnabled()) {
230236
long duration = unpreciseMillisTime() - start;
231-
LOGGER.debug("Closed {} connections out of {} in {} ms", closedCount, totalCount, duration);
237+
if (closedCount > 0) {
238+
LOGGER.debug("Closed {} connections out of {} in {} ms", closedCount, totalCount, duration);
239+
}
232240
}
233241

234242
scheduleNewIdleChannelDetector(timeout.task());

0 commit comments

Comments
 (0)