From c8d0b35e1a7fa525757f1062926e9e013d8d1fd4 Mon Sep 17 00:00:00 2001 From: Henrique Prange Date: Wed, 19 Jan 2022 21:15:09 -0300 Subject: [PATCH] Optimize the ERXProperties cache Replaces the synchronized map (which synchronizes on reads and writes) with a `ConcurrentHashMap` that synchronizes write operations only. --- .../Sources/er/extensions/foundation/ERXProperties.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Frameworks/Core/ERExtensions/Sources/er/extensions/foundation/ERXProperties.java b/Frameworks/Core/ERExtensions/Sources/er/extensions/foundation/ERXProperties.java index de5d9534fab..3ac15b1069e 100644 --- a/Frameworks/Core/ERExtensions/Sources/er/extensions/foundation/ERXProperties.java +++ b/Frameworks/Core/ERExtensions/Sources/er/extensions/foundation/ERXProperties.java @@ -22,6 +22,7 @@ import java.util.Stack; import java.util.TreeMap; import java.util.TreeSet; +import java.util.concurrent.ConcurrentHashMap; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; @@ -110,7 +111,7 @@ public class ERXProperties extends Properties implements NSKeyValueCoding { * *
タイプ変換されている値を内部でキャシュし、何回も同じ変換をする必要なくなります
*/ - private static Map _cache = Collections.synchronizedMap(new HashMap<>()); + private static Map _cache = new ConcurrentHashMap<>(); /**