Skip to content

Commit b9bc105

Browse files
committed
ConcurrentHashMap for JdbcMessageStore.queryCache
To avoid a possible `ConcurrentModificationException` it is better to use a `ConcurrentHashMap` for that `computeIfAbsent()` operation on the cache
1 parent c1aa9b7 commit b9bc105

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/store/JdbcMessageStore.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2021 the original author or authors.
2+
* Copyright 2002-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -22,11 +22,11 @@
2222
import java.sql.Timestamp;
2323
import java.util.Arrays;
2424
import java.util.Collection;
25-
import java.util.HashMap;
2625
import java.util.Iterator;
2726
import java.util.List;
2827
import java.util.Map;
2928
import java.util.UUID;
29+
import java.util.concurrent.ConcurrentHashMap;
3030
import java.util.stream.Stream;
3131

3232
import javax.sql.DataSource;
@@ -171,7 +171,7 @@ public String getSql() {
171171

172172
private final String vendorName;
173173

174-
private final Map<Query, String> queryCache = new HashMap<>();
174+
private final Map<Query, String> queryCache = new ConcurrentHashMap<>();
175175

176176
private String region = "DEFAULT";
177177

0 commit comments

Comments
 (0)