Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2020 the original author or authors.
* Copyright 2002-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.
Expand Down Expand Up @@ -93,9 +93,7 @@ protected void handleMessageInternal(Message<?> message) {
synchronized (lock) {
this.store.addMessagesToGroup(correlationKey, message);
}
if (logger.isDebugEnabled()) {
logger.debug(String.format("Handled message for key [%s]: %s.", correlationKey, message));
}
logger.debug(() -> String.format("Handled message for key [%s]: %s.", correlationKey, message));
}

private Object getLock(Object correlationKey) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2013-2020 the original author or authors.
* Copyright 2013-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.
Expand Down Expand Up @@ -166,9 +166,7 @@ public Object channelToChannelName(@Nullable Object channel, long timeToLive) {
String name = this.uuid + id.incrementAndGet();
this.channels.put(name, new MessageChannelWrapper((MessageChannel) channel,
System.currentTimeMillis() + timeToLive));
if (logger.isDebugEnabled()) {
logger.debug("Registered " + channel + " as " + name);
}
logger.debug(() -> "Registered " + channel + " as " + name);
return name;
}
else {
Expand All @@ -187,8 +185,8 @@ public MessageChannel channelNameToChannel(@Nullable String name) {
else {
messageChannelWrapper = this.channels.get(name);
}
if (logger.isDebugEnabled() && messageChannelWrapper != null) {
logger.debug("Retrieved " + messageChannelWrapper.getChannel() + " with " + name);
if (messageChannelWrapper != null) {
logger.debug(() -> "Retrieved " + messageChannelWrapper.getChannel() + " with " + name);
}

return messageChannelWrapper == null ? null : messageChannelWrapper.getChannel();
Expand All @@ -211,27 +209,21 @@ public synchronized void runReaper() {

@Override
public synchronized void run() {
if (logger.isTraceEnabled()) {
logger.trace("Reaper started; channels size=" + this.channels.size());
}
logger.trace(() -> "Reaper started; channels size=" + this.channels.size());
Iterator<Entry<String, MessageChannelWrapper>> iterator = this.channels.entrySet().iterator();
long now = System.currentTimeMillis();
while (iterator.hasNext()) {
Entry<String, MessageChannelWrapper> entry = iterator.next();
if (entry.getValue().getExpireAt() < now) {
if (logger.isDebugEnabled()) {
logger.debug("Expiring " + entry.getKey() + " (" + entry.getValue().getChannel() + ")");
}
logger.debug(() -> "Expiring " + entry.getKey() + " (" + entry.getValue().getChannel() + ")");
iterator.remove();
}
}
this.reaperScheduledFuture =
getTaskScheduler()
.schedule(this, new Date(System.currentTimeMillis() + this.reaperDelay));

if (logger.isTraceEnabled()) {
logger.trace("Reaper completed; channels size=" + this.channels.size());
}
logger.trace(() -> "Reaper completed; channels size=" + this.channels.size());
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,8 @@ public final void onInit() {
dispatcherToUse.setMinSubscribers(this.minSubscribers);
this.dispatcher = dispatcherToUse;
}
else if (this.errorHandler != null && this.logger.isWarnEnabled()) {
this.logger.warn("The 'errorHandler' is ignored for the '" + getComponentName() +
else if (this.errorHandler != null) {
this.logger.warn(() -> "The 'errorHandler' is ignored for the '" + getComponentName() +
"' (an 'executor' is not provided) and exceptions will be thrown " +
"directly within the sending Thread");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,7 @@ public final void start() {
this.active = true;
doStart();
this.running = true;
if (logger.isInfoEnabled()) {
logger.info("started " + this);
}
logger.info(() -> "started " + this);
}
}
finally {
Expand All @@ -173,9 +171,7 @@ public final void stop() {
this.active = false;
doStop();
this.running = false;
if (logger.isInfoEnabled()) {
logger.info("stopped " + this);
}
logger.info(() -> "stopped " + this);
}
}
finally {
Expand All @@ -191,9 +187,7 @@ public final void stop(Runnable callback) {
this.active = false;
doStop(callback);
this.running = false;
if (logger.isInfoEnabled()) {
logger.info("stopped " + this);
}
logger.info(() -> "stopped " + this);
}
else {
callback.run();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ public ReactiveStreamsConsumer(MessageChannel inputChannel, Subscriber<Message<?
Assert.notNull(subscriber, "'subscriber' must not be null");
this.inputChannel = inputChannel;

if (inputChannel instanceof NullChannel && logger.isWarnEnabled()) {
logger.warn("The consuming from the NullChannel does not have any effects: " +
if (inputChannel instanceof NullChannel) {
logger.warn(() -> "The consuming from the NullChannel does not have any effects: " +
"it doesn't forward messages sent to it. A NullChannel is the end of the flow.");
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2020 the original author or authors.
* Copyright 2002-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.
Expand Down Expand Up @@ -529,9 +529,7 @@ private Object doSendAndReceive(Object object, boolean shouldConvert) {
}
}
catch (Throwable ex) { // NOSONAR (catch throwable)
if (logger.isDebugEnabled()) {
logger.debug("failure occurred in gateway sendAndReceive: " + ex.getMessage());
}
logger.debug(() -> "failure occurred in gateway sendAndReceive: " + ex.getMessage());
reply = ex;
if (sample != null) {
sample.stop(buildSendTimer(false, ex.getClass().getSimpleName()));
Expand Down Expand Up @@ -708,9 +706,7 @@ private Mono<Message<?>> buildReplyMono(Message<?> requestMessage, Mono<Message<
}

private Mono<Message<?>> handleSendError(Message<?> requestMessage, Throwable exception) {
if (logger.isDebugEnabled()) {
logger.debug("failure occurred in gateway sendAndReceiveReactive: " + exception.getMessage());
}
logger.debug(() -> "failure occurred in gateway sendAndReceiveReactive: " + exception.getMessage());
MessageChannel channel = getErrorChannel();
if (channel != null) {
ErrorMessage errorMessage = buildErrorMessage(requestMessage, exception);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2019-2020 the original author or authors.
* Copyright 2019-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.
Expand Down Expand Up @@ -37,8 +37,8 @@ public abstract class AbstractReactiveMessageHandler extends MessageHandlerSuppo
@Override
public Mono<Void> handleMessage(final Message<?> message) {
Assert.notNull(message, "message must not be null");
if (isLoggingEnabled() && this.logger.isDebugEnabled()) {
this.logger.debug(this + " received message: " + message);
if (isLoggingEnabled()) {
this.logger.debug(() -> this + " received message: " + message);
}

final Message<?> messageToUse;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2020 the original author or authors.
* Copyright 2002-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.
Expand Down Expand Up @@ -143,8 +143,8 @@ else if (this.requiresReply && !isAsync()) {
throw new ReplyRequiredException(message, "No reply produced by handler '" +
getComponentName() + "', and its 'requiresReply' property is set to true.");
}
else if (!isAsync() && logger.isDebugEnabled()) {
logger.debug("handler '" + this + "' produced no reply for request Message: " + message);
else if (!isAsync()) {
logger.debug(() -> "handler '" + this + "' produced no reply for request Message: " + message);
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2020 the original author or authors.
* Copyright 2002-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.
Expand Down Expand Up @@ -182,9 +182,7 @@ public final void start() {
if (!this.running) {
doStart();
this.running = true;
if (logger.isInfoEnabled()) {
logger.info("started " + this);
}
logger.info(() -> "started " + this);
}
}
finally {
Expand All @@ -199,9 +197,7 @@ public final void stop() {
if (this.running) {
doStop();
this.running = false;
if (logger.isInfoEnabled()) {
logger.info("stopped " + this);
}
logger.info(() -> "stopped " + this);
}
}
finally {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2020 the original author or authors.
* Copyright 2002-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.
Expand Down Expand Up @@ -73,8 +73,8 @@ protected Object doInvoke(ExecutionCallback callback, Object target, Message<?>
}
try {
Object result = callback.execute();
if (logger.isDebugEnabled() && metadata.getFailures().get() > 0) {
logger.debug("Closing Circuit Breaker for " + target);
if (metadata.getFailures().get() > 0) {
logger.debug(() -> "Closing Circuit Breaker for " + target);
}
metadata.getFailures().set(0);
return result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -830,8 +830,8 @@ private boolean isPausableMethod(Method pausableMethod) {
|| Lifecycle.class.isAssignableFrom(declaringClass))
&& ReflectionUtils.findMethod(Pausable.class, pausableMethod.getName(),
pausableMethod.getParameterTypes()) != null;
if (pausable && this.logger.isTraceEnabled()) {
this.logger.trace(pausableMethod + " is not considered a candidate method unless explicitly requested");
if (pausable) {
this.logger.trace(() -> pausableMethod + " is not considered a candidate method unless explicitly requested");
}
return pausable;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2020 the original author or authors.
* Copyright 2002-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.
Expand Down Expand Up @@ -230,9 +230,7 @@ public void replaceChannelMappings(Properties channelMappings) {
private void doSetChannelMappings(Map<String, String> newChannelMappings) {
Map<String, String> oldChannelMappings = this.channelMappings;
this.channelMappings = newChannelMappings;
if (logger.isDebugEnabled()) {
logger.debug("Channel mappings: " + oldChannelMappings + " replaced with: " + newChannelMappings);
}
logger.debug(() -> "Channel mappings: " + oldChannelMappings + " replaced with: " + newChannelMappings);
}

private MessageChannel resolveChannelForName(String channelName, Message<?> message) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-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.
Expand Down Expand Up @@ -76,9 +76,7 @@ protected Object doTransform(Message<?> message) {
Message<?> retrievedMessage;
if (this.removeMessage) {
retrievedMessage = this.messageStore.removeMessage(id);
if (logger.isDebugEnabled()) {
logger.debug("Removed Message with claim-check '" + id + "' from the MessageStore.");
}
logger.debug(() -> "Removed Message with claim-check '" + id + "' from the MessageStore.");
}
else {
retrievedMessage = this.messageStore.getMessage(id);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-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.
Expand Down Expand Up @@ -113,8 +113,8 @@ public void onInit() {
((BeanFactoryAware) this.messageProcessor).setBeanFactory(beanFactory);
}

if (!shouldOverwrite && !this.shouldSkipNulls && logger.isWarnEnabled()) {
logger.warn(getComponentName() +
if (!shouldOverwrite && !this.shouldSkipNulls) {
logger.warn(() -> getComponentName() +
" is configured to not overwrite existing headers. 'shouldSkipNulls = false' will have no effect");
}
}
Expand Down Expand Up @@ -192,13 +192,13 @@ private void addHeadersFromMessageProcessor(Message<?> message,
messageBuilder.setHeader((String) key, entry.getValue());
}
}
else if (logger.isDebugEnabled()) {
logger.debug("ignoring value for non-String key: " + key);
else {
logger.debug(() -> "ignoring value for non-String key: " + key);
}
}
}
else if (logger.isDebugEnabled()) {
logger.debug("expected a Map result from processor, but received: " + result);
else {
logger.debug(() -> "expected a Map result from processor, but received: " + result);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -588,8 +588,8 @@ else if (payload instanceof String) {
+ "' timestamp on file: " + fileToReturn);
}
}
else if (this.logger.isWarnEnabled()) {
this.logger.warn("Could not set lastModified, header " + FileHeaders.SET_MODIFIED
else {
this.logger.warn(() -> "Could not set lastModified, header " + FileHeaders.SET_MODIFIED
+ " must be a Number, not " + (timestamp == null ? "null" : timestamp.getClass()));
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016-2020 the original author or authors.
* Copyright 2016-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.
Expand Down Expand Up @@ -246,10 +246,8 @@ protected AbstractFileInfo<F> poll() {

private void resetFilterIfNecessary(AbstractFileInfo<F> file) {
if (this.filter instanceof ResettableFileListFilter) {
if (this.logger.isInfoEnabled()) {
this.logger.info("Removing the remote file '" + file +
"' from the filter for a subsequent transfer attempt");
}
this.logger.info(() -> "Removing the remote file '" + file +
"' from the filter for a subsequent transfer attempt");
((ResettableFileListFilter<F>) this.filter).remove(file.getFileInfo());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -284,11 +284,11 @@ protected void onInit() {
}

private void validateSupportedMethods() {
if (this.requestPayloadType != null && logger.isWarnEnabled() &&
if (this.requestPayloadType != null &&
CollectionUtils.containsAny(NON_READABLE_BODY_HTTP_METHODS,
Arrays.asList(getRequestMapping().getMethods()))) {

logger.warn("The 'requestPayloadType' attribute will have no relevance for one " +
logger.warn(() -> "The 'requestPayloadType' attribute will have no relevance for one " +
"of the specified HTTP methods '" + NON_READABLE_BODY_HTTP_METHODS + "'");
}
}
Expand Down
Loading