Example usage for java.util Collections synchronizedMap

List of usage examples for java.util Collections synchronizedMap

Introduction

In this page you can find the example usage for java.util Collections synchronizedMap.

Prototype

public static <K, V> Map<K, V> synchronizedMap(Map<K, V> m) 

Source Link

Document

Returns a synchronized (thread-safe) map backed by the specified map.

Usage

From source file:com.mirth.connect.connectors.jms.DefaultRedeliveryHandler.java

public DefaultRedeliveryHandler() {
    messages = Collections.synchronizedMap(new LRUMap(256));
}

From source file:org.ajax4jsf.util.ServicesUtils.java

/**
 * @param name/*from w  w  w. jav a 2  s  .com*/
 * @return
 * @throws ClassNotFoundException
 */
public static Class<?> getService(String name) throws ClassNotFoundException {
    Map<ClassLoader, Class<?>> contextClasses = _services.get(name);
    if (null == contextClasses) {
        contextClasses = Collections.synchronizedMap(new HashMap<ClassLoader, Class<?>>());
        _services.put(name, contextClasses);
    }
    ClassLoader loader = Thread.currentThread().getContextClassLoader();
    Class<?> serviceClass = contextClasses.get(loader);
    if (null == serviceClass) {
        serviceClass = loadServiceClass(loader, name);
        contextClasses.put(loader, serviceClass);
    }
    return serviceClass;
}

From source file:com.sitewhere.common.ExpiringLRUCache.java

@SuppressWarnings("unchecked")
public ExpiringLRUCache(int size, int expirationInMs) {
    map = Collections.synchronizedMap(new LRUMap(size));
    this.expirationInMS = expirationInMs;
}

From source file:ips1ap101.lib.core.util.ClassX.java

protected ClassX() {
    cache = Collections.synchronizedMap(new HashMap<String, Class<?>>());
    PACKAGE = "subclass_package";
    SUFFIX = "subclass_suffix";
    SIMPLE = ClassX.class.getSimpleName();
}

From source file:ContextBinder.java

public ContextObject() {

    map = Collections.synchronizedMap(new HashMap());
}

From source file:net.ontopia.persistence.proxy.TransactionalLRULookupIndex.java

public TransactionalLRULookupIndex(CacheIF cache, int lrusize) {
    this.cache = cache;
    this.lru = Collections.synchronizedMap(new LRUMap(lrusize));
    this.lrusize = lrusize;
}

From source file:org.richfaces.skin.SkinFactory.java

public static void reset() {
    instances = Collections.synchronizedMap(new HashMap<ClassLoader, SkinFactory>());
}

From source file:net.ontopia.persistence.proxy.DefaultCaches.java

public <K, V> Map<K, V> createDataCache() {
    return Collections.synchronizedMap(this.<K, V>createSoftHashMap());
}

From source file:com.memetix.translate.LRUCache.java

public LRUCache(int maxSize) {
    //Defaults to Scan Until Removable when LRUMap is Full
    map = Collections.synchronizedMap(new LRUMap<Object, Object>(maxSize, true));
}

From source file:org.structr.api.util.FixedSizeCache.java

public FixedSizeCache(final int maxSize) {
    this.cache = Collections.synchronizedMap(new InvalidatingLRUMap<>(maxSize));
}