From c908a707e8ec86ba2efe8949c42f996629cc7033 Mon Sep 17 00:00:00 2001 From: naoto Date: Tue, 12 Jul 2011 10:28:37 -0700 Subject: [PATCH] 7022407: Spinning CPU in LocaleObjectCache.get() Reviewed-by: okutsu --- .../classes/sun/util/locale/LocaleObjectCache.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/share/classes/sun/util/locale/LocaleObjectCache.java b/src/share/classes/sun/util/locale/LocaleObjectCache.java index 35504bcad..88920aaf5 100644 --- a/src/share/classes/sun/util/locale/LocaleObjectCache.java +++ b/src/share/classes/sun/util/locale/LocaleObjectCache.java @@ -66,14 +66,14 @@ public abstract class LocaleObjectCache { CacheEntry newEntry = new CacheEntry<>(key, newVal, queue); - while (value == null) { - cleanStaleEntries(); - entry = map.putIfAbsent(key, newEntry); - if (entry == null) { + entry = map.putIfAbsent(key, newEntry); + if (entry == null) { + value = newVal; + } else { + value = entry.get(); + if (value == null) { + map.put(key, newEntry); value = newVal; - break; - } else { - value = entry.get(); } } } -- GitLab