From c7f2c172a6cdbca88f95a7910c6d0ae04ec24a25 Mon Sep 17 00:00:00 2001 From: Artem Bilan Date: Wed, 2 Feb 2022 12:36:05 -0500 Subject: [PATCH] Fix various sporadic test failures * Increase a `default-delay="1000"` for `GatewayInterfaceTests` to test the late reply scenario * Use a `ConcurrentHashMap` for `JdbcMessageStore.queryCache` to avoid a possible `ConcurrentModificationException` --- .../integration/gateway/GatewayInterfaceTests-context.xml | 2 +- .../integration/jdbc/store/JdbcMessageStore.java | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/spring-integration-core/src/test/java/org/springframework/integration/gateway/GatewayInterfaceTests-context.xml b/spring-integration-core/src/test/java/org/springframework/integration/gateway/GatewayInterfaceTests-context.xml index 6fc80a6d01..c2bdeae0f7 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/gateway/GatewayInterfaceTests-context.xml +++ b/spring-integration-core/src/test/java/org/springframework/integration/gateway/GatewayInterfaceTests-context.xml @@ -25,7 +25,7 @@ - + diff --git a/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/store/JdbcMessageStore.java b/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/store/JdbcMessageStore.java index 784957e656..3aafce78f0 100644 --- a/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/store/JdbcMessageStore.java +++ b/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/store/JdbcMessageStore.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2021 the original author or authors. + * Copyright 2002-2022 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. @@ -22,11 +22,11 @@ import java.sql.SQLException; import java.sql.Timestamp; import java.util.Arrays; import java.util.Collection; -import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.UUID; +import java.util.concurrent.ConcurrentHashMap; import java.util.stream.Stream; import javax.sql.DataSource; @@ -171,7 +171,7 @@ public class JdbcMessageStore extends AbstractMessageGroupStore implements Messa private final String vendorName; - private final Map queryCache = new HashMap<>(); + private final Map queryCache = new ConcurrentHashMap<>(); private String region = "DEFAULT";