Example usage for java.util.concurrent ConcurrentHashMap ConcurrentHashMap

List of usage examples for java.util.concurrent ConcurrentHashMap ConcurrentHashMap

Introduction

In this page you can find the example usage for java.util.concurrent ConcurrentHashMap ConcurrentHashMap.

Prototype

public ConcurrentHashMap(Map<? extends K, ? extends V> m) 

Source Link

Document

Creates a new map with the same mappings as the given map.

Usage

From source file:Main.java

public static <KEY, VALUE> ConcurrentHashMap<KEY, VALUE> newConcurrentHashMap(Map<KEY, VALUE> map) {
    return new ConcurrentHashMap<KEY, VALUE>(map);
}

From source file:Main.java

public static <K, V> ConcurrentHashMap<K, V> newConcurrentHashMap(final Map<? extends K, ? extends V> m) {
    return new ConcurrentHashMap<K, V>(m);
}

From source file:Main.java

public static <KEY, VALUE> ConcurrentHashMap<KEY, VALUE> newConcurrentHashMapSized(int size) {
    return new ConcurrentHashMap<KEY, VALUE>(size);
}

From source file:com.sm.store.cluster.Utils.java

public static ConcurrentMap<Integer, Short> buildPartitionMap(List<ClusterNodes> nodes) {
    ConcurrentMap<Integer, Short> map = new ConcurrentHashMap<Integer, Short>(nodes.size());
    for (ClusterNodes node : nodes) {
        for (int i = 0; i < node.getPartitionArray().length; i++) {
            map.put(node.getPartitionArray()[i], node.getId());
        }//  w  w  w  .  j a  v a2 s  . c o m
    }
    return map;
}

From source file:example.caching.SimpleBookRepository.java

public SimpleBookRepository(Map<Long, Book> content) {

    Assert.notNull(content, "Source map must not be null!");
    this.content = new ConcurrentHashMap<Long, Book>(content);
}

From source file:ru.jconsulting.likeable.DomainTypeRegistry.java

public void afterPropertiesSet() {
    type2ClassMap = new ConcurrentHashMap<String, Class<?>>(domainClassList.size());
    for (Class<?> clazz : domainClassList) {
        type2ClassMap.put(GrailsNameUtils.getPropertyName(clazz), clazz);
    }/*www.j  a v a  2  s . com*/
}

From source file:com.sm.store.client.netty.ScanClientHandler.java

public ScanClientHandler(long timeout, Serializer serializer) {
    this.timeout = timeout;
    this.serializer = serializer;
    if (this.serializer == null)
        this.serializer = new HessianSerializer();
    this.map = new ConcurrentHashMap<Long, AsynReq>(119);
}

From source file:com.nagarro.core.security.impl.DefaultBruteForceAttackCounter.java

public DefaultBruteForceAttackCounter(final Integer maxFailedLogins, final Integer cacheExpiration,
        final Integer cacheSizeLimit) {
    bruteForceAttackCache = new ConcurrentHashMap((int) 0.5 * cacheSizeLimit.intValue());
    this.maxFailedLogins = maxFailedLogins;
    this.cacheSizeLimit = cacheSizeLimit;
    this.cacheExpiration = cacheExpiration;
}

From source file:cec.easyshop.storefront.security.impl.DefaultBruteForceAttackCounter.java

public DefaultBruteForceAttackCounter(final Integer maxFailedLogins, final Integer cacheExpiration,
        final Integer cacheSizeLimit) {
    bruteForceAttackCache = new ConcurrentHashMap((int) 0.5 * cacheSizeLimit);
    this.maxFailedLogins = maxFailedLogins;
    this.cacheSizeLimit = cacheSizeLimit;
    this.cacheExpiration = cacheExpiration;
}

From source file:com.loadtesting.showcase.springmvc.model.converter.FastTimeConverter.java

public FastTimeConverter(String pattern) {
    int length = TimeZone.getAvailableIDs().length;
    this.map = new ConcurrentHashMap<TimeZone, FastDateFormat>(length);
    this.pattern = pattern;
}