Fix new Sonar smells
Upgrade dependencies for upcoming release
This commit is contained in:
@@ -18,7 +18,6 @@ package org.springframework.integration.channel;
|
||||
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
import org.springframework.integration.support.channel.ChannelResolverUtils;
|
||||
import org.springframework.messaging.core.DestinationResolver;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ErrorHandler;
|
||||
|
||||
@@ -27,6 +26,7 @@ import org.springframework.util.ErrorHandler;
|
||||
*
|
||||
* @author Artem Bilan
|
||||
* @author Gary Russell
|
||||
*
|
||||
* @since 5.2
|
||||
*
|
||||
*/
|
||||
@@ -42,7 +42,8 @@ public final class ChannelUtils {
|
||||
* Obtain an {@link ErrorHandler} registered with the
|
||||
* {@value MESSAGE_PUBLISHING_ERROR_HANDLER_BEAN_NAME} bean name.
|
||||
* By default resolves to the {@link org.springframework.integration.channel.MessagePublishingErrorHandler}
|
||||
* with the {@value ChannelResolverUtils#CHANNEL_RESOLVER_BEAN_NAME} {@link DestinationResolver} bean.
|
||||
* with the {@value ChannelResolverUtils#CHANNEL_RESOLVER_BEAN_NAME}
|
||||
* {@link org.springframework.messaging.core.DestinationResolver} bean.
|
||||
* @param beanFactory BeanFactory for lookup, must not be null.
|
||||
* @return the instance of {@link ErrorHandler} bean whose name is
|
||||
* {@value MESSAGE_PUBLISHING_ERROR_HANDLER_BEAN_NAME}.
|
||||
|
||||
@@ -61,23 +61,23 @@ import org.springframework.util.StringUtils;
|
||||
@SuppressWarnings("deprecation")
|
||||
public class IntegrationManagementConfigurer
|
||||
implements SmartInitializingSingleton, ApplicationContextAware, BeanNameAware,
|
||||
DestructionAwareBeanPostProcessor {
|
||||
DestructionAwareBeanPostProcessor {
|
||||
|
||||
private static final Log logger = LogFactory.getLog(IntegrationManagementConfigurer.class);
|
||||
private static final Log LOGGER = LogFactory.getLog(IntegrationManagementConfigurer.class);
|
||||
|
||||
public static final String MANAGEMENT_CONFIGURER_NAME = "integrationManagementConfigurer";
|
||||
|
||||
private final Map<String, org.springframework.integration.support.management.MessageChannelMetrics>
|
||||
channelsByName = new HashMap<>();
|
||||
channelsByName = new HashMap<>();
|
||||
|
||||
private final Map<String, org.springframework.integration.support.management.MessageHandlerMetrics>
|
||||
handlersByName = new HashMap<>();
|
||||
handlersByName = new HashMap<>();
|
||||
|
||||
private final Map<String, org.springframework.integration.support.management.MessageSourceMetrics>
|
||||
sourcesByName = new HashMap<>();
|
||||
sourcesByName = new HashMap<>();
|
||||
|
||||
private final Map<String,
|
||||
org.springframework.integration.support.management.MessageSourceMetricsConfigurer>
|
||||
org.springframework.integration.support.management.MessageSourceMetricsConfigurer>
|
||||
sourceConfigurers = new HashMap<>();
|
||||
|
||||
private ApplicationContext applicationContext;
|
||||
@@ -229,7 +229,7 @@ public class IntegrationManagementConfigurer
|
||||
* Exception logging (debug or otherwise) is not affected by this setting.
|
||||
* <p>
|
||||
* It has been found that in high-volume messaging environments, calls to methods such as
|
||||
* {@code logger.isDebuggingEnabled()} can be quite expensive and account for an inordinate amount of CPU
|
||||
* {@link Log#isDebugEnabled()} can be quite expensive and account for an inordinate amount of CPU
|
||||
* time.
|
||||
* <p>
|
||||
* Set this to false to disable logging by default in all framework components that implement
|
||||
@@ -263,7 +263,7 @@ public class IntegrationManagementConfigurer
|
||||
}
|
||||
if (this.metricsFactory == null) {
|
||||
Map<String, org.springframework.integration.support.management.MetricsFactory>
|
||||
factories = this.applicationContext
|
||||
factories = this.applicationContext
|
||||
.getBeansOfType(org.springframework.integration.support.management.MetricsFactory.class);
|
||||
if (factories.size() == 1) {
|
||||
this.metricsFactory = factories.values().iterator().next();
|
||||
@@ -327,22 +327,25 @@ public class IntegrationManagementConfigurer
|
||||
this.handlersByName.remove(nameOfBean + ".handler");
|
||||
}
|
||||
}
|
||||
else if (bean instanceof org.springframework.integration.support.management.MessageSourceMetrics) {
|
||||
if (this.sourcesByName.remove(nameOfBean) == null) {
|
||||
this.sourcesByName.remove(nameOfBean + ".source");
|
||||
}
|
||||
else if (bean instanceof org.springframework.integration.support.management.MessageSourceMetrics &&
|
||||
this.sourcesByName.remove(nameOfBean) == null) {
|
||||
|
||||
this.sourcesByName.remove(nameOfBean + ".source");
|
||||
}
|
||||
}
|
||||
|
||||
private Object doConfigureMetrics(Object bean, String name) {
|
||||
if (bean instanceof org.springframework.integration.support.management.MessageChannelMetrics) {
|
||||
configureChannelMetrics(name, (org.springframework.integration.support.management.MessageChannelMetrics) bean);
|
||||
configureChannelMetrics(name,
|
||||
(org.springframework.integration.support.management.MessageChannelMetrics) bean);
|
||||
}
|
||||
else if (bean instanceof org.springframework.integration.support.management.MessageHandlerMetrics) {
|
||||
configureHandlerMetrics(name, (org.springframework.integration.support.management.MessageHandlerMetrics) bean);
|
||||
configureHandlerMetrics(name,
|
||||
(org.springframework.integration.support.management.MessageHandlerMetrics) bean);
|
||||
}
|
||||
else if (bean instanceof org.springframework.integration.support.management.MessageSourceMetrics) {
|
||||
configureSourceMetrics(name, (org.springframework.integration.support.management.MessageSourceMetrics) bean);
|
||||
configureSourceMetrics(name,
|
||||
(org.springframework.integration.support.management.MessageSourceMetrics) bean);
|
||||
this.sourceConfigurers.values().forEach(c -> c
|
||||
.configure((org.springframework.integration.support.management.MessageSourceMetrics) bean, name));
|
||||
}
|
||||
@@ -469,8 +472,8 @@ public class IntegrationManagementConfigurer
|
||||
if (this.channelsByName.containsKey(name)) {
|
||||
return this.channelsByName.get(name);
|
||||
}
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("No channel found for (" + name + ")");
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug("No channel found for (" + name + ")");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -483,8 +486,8 @@ public class IntegrationManagementConfigurer
|
||||
return this.handlersByName.get(name + ".handler");
|
||||
}
|
||||
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("No handler found for (" + name + ")");
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug("No handler found for (" + name + ")");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -497,8 +500,8 @@ public class IntegrationManagementConfigurer
|
||||
return this.sourcesByName.get(name + ".source");
|
||||
}
|
||||
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("No source found for (" + name + ")");
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug("No source found for (" + name + ")");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -29,9 +29,11 @@ import org.apache.commons.logging.LogFactory;
|
||||
*/
|
||||
public abstract class AbstractMessageChannelMetrics implements ConfigurableMetrics {
|
||||
|
||||
protected final Log logger = LogFactory.getLog(getClass());
|
||||
private static final String DEPRECATION = "deprecation";
|
||||
|
||||
protected final String name;
|
||||
protected final Log logger = LogFactory.getLog(getClass()); // NOSONAR - final
|
||||
|
||||
protected final String name; // NOSONAR - final
|
||||
|
||||
private volatile boolean fullStatsEnabled;
|
||||
|
||||
@@ -61,7 +63,7 @@ public abstract class AbstractMessageChannelMetrics implements ConfigurableMetri
|
||||
* @return the context to be used in a subsequent {@link #afterSend(MetricsContext, boolean)}
|
||||
* call.
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
@SuppressWarnings(DEPRECATION)
|
||||
public abstract MetricsContext beforeSend();
|
||||
|
||||
/**
|
||||
@@ -71,7 +73,7 @@ public abstract class AbstractMessageChannelMetrics implements ConfigurableMetri
|
||||
* @param context the context.
|
||||
* @param result true for success, false otherwise.
|
||||
*/
|
||||
public abstract void afterSend(@SuppressWarnings("deprecation") MetricsContext context, boolean result);
|
||||
public abstract void afterSend(@SuppressWarnings(DEPRECATION) MetricsContext context, boolean result);
|
||||
|
||||
/**
|
||||
* Reset all counters/statistics.
|
||||
@@ -102,13 +104,13 @@ public abstract class AbstractMessageChannelMetrics implements ConfigurableMetri
|
||||
|
||||
public abstract double getStandardDeviationSendDuration();
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@SuppressWarnings(DEPRECATION)
|
||||
public abstract Statistics getSendDuration();
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@SuppressWarnings(DEPRECATION)
|
||||
public abstract Statistics getSendRate();
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@SuppressWarnings(DEPRECATION)
|
||||
public abstract Statistics getErrorRate();
|
||||
|
||||
public abstract void afterReceive();
|
||||
|
||||
@@ -27,7 +27,6 @@ package org.springframework.integration.support.management;
|
||||
*
|
||||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("deprecation")
|
||||
public class AggregatingMetricsFactory implements MetricsFactory {
|
||||
|
||||
private final int sampleSize;
|
||||
|
||||
@@ -30,7 +30,6 @@ package org.springframework.integration.support.management;
|
||||
*
|
||||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("deprecation")
|
||||
public class DefaultMetricsFactory implements MetricsFactory {
|
||||
|
||||
@Override
|
||||
|
||||
@@ -41,7 +41,6 @@ import java.util.List;
|
||||
* @since 2.0
|
||||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("deprecation")
|
||||
public class ExponentialMovingAverage {
|
||||
|
||||
private volatile long count;
|
||||
@@ -50,7 +49,7 @@ public class ExponentialMovingAverage {
|
||||
|
||||
private volatile double max;
|
||||
|
||||
private final Deque<Double> samples = new ArrayDeque<Double>();
|
||||
private final Deque<Double> samples = new ArrayDeque<>();
|
||||
|
||||
private final int retention;
|
||||
|
||||
|
||||
@@ -46,7 +46,6 @@ import java.util.List;
|
||||
*
|
||||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("deprecation")
|
||||
public class ExponentialMovingAverageRate {
|
||||
|
||||
private volatile double min = Double.MAX_VALUE;
|
||||
@@ -61,7 +60,7 @@ public class ExponentialMovingAverageRate {
|
||||
|
||||
private final double period;
|
||||
|
||||
private final Deque<Long> times = new ArrayDeque<Long>();
|
||||
private final Deque<Long> times = new ArrayDeque<>();
|
||||
|
||||
private final int retention;
|
||||
|
||||
|
||||
@@ -47,7 +47,6 @@ import java.util.List;
|
||||
* @since 2.0
|
||||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("deprecation")
|
||||
public class ExponentialMovingAverageRatio {
|
||||
|
||||
private volatile double t0;
|
||||
@@ -60,9 +59,9 @@ public class ExponentialMovingAverageRatio {
|
||||
|
||||
private final double lapse;
|
||||
|
||||
private final Deque<Long> times = new ArrayDeque<Long>();
|
||||
private final Deque<Long> times = new ArrayDeque<>();
|
||||
|
||||
private final Deque<Integer> values = new ArrayDeque<Integer>();
|
||||
private final Deque<Integer> values = new ArrayDeque<>();
|
||||
|
||||
private final int retention;
|
||||
|
||||
|
||||
@@ -34,14 +34,13 @@ import org.springframework.jmx.export.annotation.ManagedOperation;
|
||||
*/
|
||||
@Deprecated
|
||||
@IntegrationManagedResource
|
||||
@SuppressWarnings("deprecation")
|
||||
public class LifecycleMessageHandlerMetrics implements
|
||||
org.springframework.integration.support.management.MessageHandlerMetrics, Lifecycle,
|
||||
ConfigurableMetricsAware<AbstractMessageHandlerMetrics> {
|
||||
|
||||
private final Lifecycle lifecycle;
|
||||
|
||||
protected final org.springframework.integration.support.management.MessageHandlerMetrics delegate;
|
||||
protected final org.springframework.integration.support.management.MessageHandlerMetrics delegate; // NOSONAR
|
||||
|
||||
|
||||
public LifecycleMessageHandlerMetrics(Lifecycle lifecycle,
|
||||
|
||||
@@ -28,7 +28,6 @@ package org.springframework.integration.support.management;
|
||||
*/
|
||||
@Deprecated
|
||||
@FunctionalInterface
|
||||
@SuppressWarnings("deprecation")
|
||||
public interface MessageSourceMetricsConfigurer {
|
||||
|
||||
void configure(MessageSourceMetrics metrics, String beanName);
|
||||
|
||||
Reference in New Issue
Block a user