Added isXXXEnabled for logging statements

Guarded the logging statements which do concatenation of strings
or calling toString on objects. When a log level isn't enabled
this still would produce garbage that would need to be collected.

Guarded all logging up to info, warn and error can be assumed to be
enabled on a production system.
This commit is contained in:
Marten Deinum
2020-12-03 15:58:53 +01:00
committed by Mahmoud Ben Hassine
parent 3fbfbb9503
commit b7d144c10d
30 changed files with 175 additions and 102 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2019 the original author or authors.
* Copyright 2006-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -193,7 +193,9 @@ public class ChunkMessageChannelItemWriter<T> extends StepExecutionListenerSuppo
int count = 0;
int maxCount = maxWaitTimeouts;
Throwable failure = null;
logger.info("Waiting for " + localState.getExpecting() + " results");
if (logger.isInfoEnabled()) {
logger.info("Waiting for " + localState.getExpecting() + " results");
}
while (localState.getExpecting() > 0 && count++ < maxCount) {
try {
getNextResult();