Synchronizing the COMMON Map so that getInstance doesn't miss a put from a subclass in another thread. LANG-494
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@897408 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
2493294550
commit
72e4ab4b00
|
@ -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 @@ public class CharSet implements Serializable {
|
|||
|
||||
/**
|
||||
* 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);
|
||||
|
|
Loading…
Reference in New Issue