commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r754469 - /commons/proper/lang/trunk/src/java/org/apache/commons/lang/LocaleUtils.java
Date Sat, 14 Mar 2009 16:02:19 GMT
Author: sebb
Date: Sat Mar 14 16:02:18 2009
New Revision: 754469

URL: http://svn.apache.org/viewvc?rev=754469&view=rev
Log:
Add synch for lazily created static field

Modified:
    commons/proper/lang/trunk/src/java/org/apache/commons/lang/LocaleUtils.java

Modified: commons/proper/lang/trunk/src/java/org/apache/commons/lang/LocaleUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/java/org/apache/commons/lang/LocaleUtils.java?rev=754469&r1=754468&r2=754469&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/java/org/apache/commons/lang/LocaleUtils.java (original)
+++ commons/proper/lang/trunk/src/java/org/apache/commons/lang/LocaleUtils.java Sat Mar 14
16:02:18 2009
@@ -42,7 +42,8 @@
     /** Unmodifiable list of available locales. */
     private static final List cAvailableLocaleList;
     /** Unmodifiable set of available locales. */
-    private static Set cAvailableLocaleSet;
+    //@GuardedBy("this")
+    private static Set cAvailableLocaleSet; // lazily created by availableLocaleSet()
     /** Unmodifiable map of language locales by country. */
     private static final Map cLanguagesByCountry = Collections.synchronizedMap(new HashMap());
     /** Unmodifiable map of country locales by language. */
@@ -205,7 +206,7 @@
      *
      * @return the unmodifiable set of available locales
      */
-    public static Set availableLocaleSet() {
+    public static synchronized Set availableLocaleSet() {
         Set set = cAvailableLocaleSet;
         if (set == null) {
             set = new HashSet(availableLocaleList());



Mime
View raw message