Switch to ConcurrentHashMap for licenses.

This means that we shouldn't get any problems with concurrent access to licenses.
This commit is contained in:
Matthew Buckett 2014-01-14 10:20:07 +00:00
parent 034fb3dd93
commit c883de13d1

View file

@ -43,6 +43,7 @@ import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.Map; import java.util.Map;
import java.util.StringTokenizer; import java.util.StringTokenizer;
import java.util.concurrent.ConcurrentHashMap;
import com.sun.syndication.feed.impl.EqualsBean; import com.sun.syndication.feed.impl.EqualsBean;
import com.sun.syndication.feed.impl.ToStringBean; import com.sun.syndication.feed.impl.ToStringBean;
@ -53,7 +54,7 @@ import com.sun.syndication.feed.impl.ToStringBean;
*/ */
public class License { public class License {
private static final String CC_START = "http://creativecommons.org/licenses/"; private static final String CC_START = "http://creativecommons.org/licenses/";
private static final Map lookupLicense = new HashMap(); private static final Map lookupLicense = new ConcurrentHashMap();
public static final License NO_DERIVS = new License("http://creativecommons.org/licenses/nd/1.0/", new Behaviour[0], new Behaviour[] { public static final License NO_DERIVS = new License("http://creativecommons.org/licenses/nd/1.0/", new Behaviour[0], new Behaviour[] {
Behaviour.DISTRIBUTION, Behaviour.REPRODUCTION }); Behaviour.DISTRIBUTION, Behaviour.REPRODUCTION });
public static final License NO_DERIVS_NONCOMMERCIAL = new License("http://creativecommons.org/licenses/nd-nc/1.0/", public static final License NO_DERIVS_NONCOMMERCIAL = new License("http://creativecommons.org/licenses/nd-nc/1.0/",