List of usage examples for java.util Collections synchronizedMap
public static <K, V> Map<K, V> synchronizedMap(Map<K, V> m)
From source file:byps.BServer.java
public BServer(BTransport transport, BClient clientR) { this.transport = transport; this.clientR = clientR; this.remotes = Collections.synchronizedMap(new HashMap<Integer, BSkeleton>()); }
From source file:org.mule.util.queue.CachingPersistenceStrategy.java
public CachingPersistenceStrategy(QueuePersistenceStrategy ps) { this.ps = ps; this.objects = Collections.synchronizedMap(new ReferenceMap()); }
From source file:Main.java
public static <K, V> Map<K, V> synchronizedMap(int initialCapacity, float loadFactor) { return Collections.synchronizedMap(new HashMap<K, V>(initialCapacity, loadFactor)); }
From source file:com.taobao.itest.util.PropertiesUtil.java
/** * The properties file key-value information into a Map, if the key contains * a underline into the next hump style change * // ww w . j av a 2s . c o m * @param resourceName * @param characterSet * @return * @throws IOException */ public static Map<String, String> loadProperties(String resourceName, String characterSet) { Properties properties; Map<String, String> paramsMap = Collections.synchronizedMap(new CamelCasingHashMap<String, String>()); try { properties = PropertiesLoaderUtils.loadAllProperties(resourceName); for (Enumeration<?> keys = properties.keys(); keys.hasMoreElements();) { String key = (String) keys.nextElement(); paramsMap.put(key, getValue(properties.getProperty(key).trim(), characterSet)); } } catch (Exception e) { e.printStackTrace(); } return paramsMap; }
From source file:Main.java
public static <K, V> Map<K, V> synchronizedMap(final int initialCapacity, final float loadFactor) { return Collections.synchronizedMap(new HashMap<K, V>(initialCapacity, loadFactor)); }
From source file:org.ots.dns.NameStore.java
protected NameStore() { globalNames = Collections.synchronizedMap(new HashMap()); localThread = new ThreadLocal(); }
From source file:net.big_oh.common.utils.RegExpHelper.java
@SuppressWarnings("unchecked") private static Map<String, Pattern> buildCompiledPatternsMap() { // The compiledPatterns Map is synchronized because it will be accessed // concurrently by multiple threads return Collections.synchronizedMap(new LRUMap(1000)); }
From source file:plugins.Indynet.Util.java
public static <String, User> Map<String, User> createLRUMap(final int maxEntries) { return Collections.synchronizedMap(new LinkedHashMap<String, User>(maxEntries * 10 / 7, 0.7f, true) { @Override//from w w w. j av a 2 s . c o m protected boolean removeEldestEntry(Map.Entry<String, User> eldest) { return size() > maxEntries; } }); }
From source file:com.sb.suite.controller.LocalizadorRecursos.java
private LocalizadorRecursos() throws ServiceLocatorException { try {//from ww w . j a v a 2 s . co m cache = Collections.synchronizedMap(new HashMap()); } catch (Exception ex) { throw new ServiceLocatorException(ex); } }
From source file:org.codehaus.groovy.grails.support.SoftThreadLocalMap.java
/** * Creates an initial value of a Map.//from www.j a va 2 s.c om */ @Override protected Map initialValue() { return Collections.synchronizedMap(new ReferenceMap(ReferenceMap.SOFT, ReferenceMap.SOFT)); }