commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bay...@apache.org
Subject svn commit: r897408 - /commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/CharSet.java
Date Sat, 09 Jan 2010 10:06:42 GMT
Author: bayard
Date: Sat Jan  9 10:06:42 2010
New Revision: 897408

URL: http://svn.apache.org/viewvc?rev=897408&view=rev
Log:
Synchronizing the COMMON Map so that getInstance doesn't miss a put from a subclass in another
thread. LANG-494

Modified:
    commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/CharSet.java

Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/CharSet.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/CharSet.java?rev=897408&r1=897407&r2=897408&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/CharSet.java (original)
+++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/CharSet.java Sat Jan
 9 10:06:42 2010
@@ -17,6 +17,7 @@
 package org.apache.commons.lang3;
 
 import java.io.Serializable;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Map;
@@ -75,10 +76,10 @@
 
     /**
      * A Map of the common cases used in the factory.
-     * Subclasses can add more common patterns if desired.
+     * Subclasses can add more common patterns if desired
      * @since 2.0
      */
-    protected static final Map<String, CharSet> COMMON = new HashMap<String, CharSet>();
+    protected static final Map<String, CharSet> COMMON = Collections.synchronizedMap(new
HashMap<String, CharSet>());
     
     static {
         COMMON.put(null, EMPTY);



Mime
View raw message