ConcurrentHashMap for JdbcMessageStore.queryCache
To avoid a possible `ConcurrentModificationException` it is better to use a `ConcurrentHashMap` for that `computeIfAbsent()` operation on the cache
This commit is contained in:
@@ -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<Query, String> queryCache = new HashMap<>();
|
||||
private final Map<Query, String> queryCache = new ConcurrentHashMap<>();
|
||||
|
||||
private String region = "DEFAULT";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user