Upgrade to Spring Integration 6.2.0

* Upgrade all other dependencies
* Fix deprecation warnings
* Fix Ruby script to a newer syntax
This commit is contained in:
Artem Bilan
2023-11-21 16:22:28 -05:00
parent c11726f1f2
commit 62e2ae1c72
72 changed files with 5202 additions and 895 deletions

View File

@@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.springframework.integration.samples</groupId>
<artifactId>monitoring</artifactId>
<version>6.1.0</version>
<version>6.2.0</version>
<url>https://github.com/spring-projects/spring-integration-samples</url>
<organization>
<name>Spring IO</name>
@@ -82,7 +82,7 @@
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.20.0</version>
<version>2.21.1</version>
<scope>compile</scope>
</dependency>
<dependency>
@@ -132,7 +132,7 @@
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>5.3.1</version>
<version>5.7.0</version>
<scope>test</scope>
</dependency>
<dependency>
@@ -166,28 +166,28 @@
<dependency>
<groupId>org.junit</groupId>
<artifactId>junit-bom</artifactId>
<version>5.9.3</version>
<version>5.10.1</version>
<scope>import</scope>
<type>pom</type>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson</groupId>
<artifactId>jackson-bom</artifactId>
<version>2.15.0</version>
<version>2.15.3</version>
<scope>import</scope>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-framework-bom</artifactId>
<version>6.0.11</version>
<version>6.1.0</version>
<scope>import</scope>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-bom</artifactId>
<version>6.1.3</version>
<version>6.2.0</version>
<scope>import</scope>
<type>pom</type>
</dependency>

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2018 the original author or authors.
* Copyright 2002-2023 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.
@@ -31,15 +31,17 @@ import org.springframework.util.StopWatch;
* based on message payload types.
*
* @author Gary Russell
* @author Artem Bilan
*
* @since 2.2
*
*/
@ManagedResource
public class PayloadAwareTimingInterceptor implements ChannelInterceptor {
private static final ThreadLocal<StopWatchHolder> stopWatchHolder = new ThreadLocal<PayloadAwareTimingInterceptor.StopWatchHolder>();
private static final ThreadLocal<StopWatchHolder> stopWatchHolder = new ThreadLocal<>();
private final Map<Class<?>, Stats> statsMap = new ConcurrentHashMap<Class<?>, PayloadAwareTimingInterceptor.Stats>();
private final Map<Class<?>, Stats> statsMap = new ConcurrentHashMap<>();
/**
*
@@ -67,12 +69,12 @@ public class PayloadAwareTimingInterceptor implements ChannelInterceptor {
public void postSend(Message<?> message, MessageChannel channel, boolean sent) {
StopWatchHolder holder = stopWatchHolder.get();
if (holder != null) {
holder.getStopWatch().stop();
Stats stats = this.statsMap.get(holder.getType());
holder.stopWatch().stop();
Stats stats = this.statsMap.get(holder.type());
if (stats == null) {
stats = this.statsMap.get(Object.class);
}
stats.add(holder.getStopWatch().getLastTaskTimeMillis());
stats.add(holder.stopWatch().lastTaskInfo().getTimeMillis());
}
}
@@ -101,28 +103,8 @@ public class PayloadAwareTimingInterceptor implements ChannelInterceptor {
return this.statsMap.get(Class.forName(className)).getAverage();
}
private static class StopWatchHolder {
private record StopWatchHolder(StopWatch stopWatch, Class<?> type) {
private final StopWatch stopWatch;
private final Class<?> type;
/**
* @param stopWatch
* @param type
*/
public StopWatchHolder(StopWatch stopWatch, Class<?> type) {
this.stopWatch = stopWatch;
this.type = type;
}
public StopWatch getStopWatch() {
return stopWatch;
}
public Class<?> getType() {
return type;
}
}
private static final class Stats {