Skip to content

Commit cfbadd3

Browse files
authored
Use synchronized HashMap. (#1678)
While there is a performance impact here it is most likely extremely minor. And dwarfed by the fact that it's causing a simple time series query to needlessly fail. Considering this isn't technically a functional change I'm not super worried about the tests... there's also the problem of exactly how to test it.... am going to keep thinking about it.
1 parent 2939d22 commit cfbadd3

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

cwms-data-api/src/main/java/cwms/cda/formatters/ContentTypeAliasMap.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@
1111
import cwms.cda.formatters.annotations.FormattableWith;
1212
import org.jetbrains.annotations.NotNull;
1313

14-
import java.util.HashMap;
1514
import java.util.Map;
15+
import java.util.concurrent.ConcurrentHashMap;
1616

1717
final class ContentTypeAliasMap {
18-
private final Map<ContentType, ContentType> contentTypeMap = new HashMap<>();
19-
private static final Map<Class<? extends CwmsDTOBase>, ContentTypeAliasMap> ALIAS_MAP = new HashMap<>();
18+
private final Map<ContentType, ContentType> contentTypeMap = new ConcurrentHashMap<>();
19+
private static final Map<Class<? extends CwmsDTOBase>, ContentTypeAliasMap> ALIAS_MAP = new ConcurrentHashMap<>();
2020

2121
private ContentTypeAliasMap()
2222
{

0 commit comments

Comments
 (0)