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:com.mirth.connect.donkey.server.queue.DestinationQueue.java

public DestinationQueue(String groupBy, int threadCount, boolean regenerateTemplate, Serializer serializer,
        MessageMaps messageMaps) {//  w ww .j a va  2  s.  c  om
    this.groupBy = StringUtils.defaultString(groupBy);
    this.regenerateTemplate = regenerateTemplate;
    this.serializer = serializer;
    this.messageMaps = messageMaps;

    if (StringUtils.isNotBlank(groupBy)) {
        queueBuckets = threadCount;

        if (queueBuckets > 1) {
            queueThreadIds = new ArrayList<Long>(queueBuckets);
            hashFunction = Hashing.murmur3_32((int) System.currentTimeMillis());
            initialThreadAssignmentMap = new ConcurrentHashMap<String, Integer>(queueBuckets);
        }
    }
}

From source file:domainregistry.HypertyService.java

protected void deleteExpiredHyperties(Connection connectionClient, String userID) {
    String actualDate = Dates.getActualDate();

    Map<String, HypertyInstance> userHyperties = connectionClient.getUserHyperties(userID);
    Map<String, HypertyInstance> hyperties = new ConcurrentHashMap<String, HypertyInstance>(userHyperties);

    for (Map.Entry<String, HypertyInstance> entry : hyperties.entrySet()) {
        String lastModified = entry.getValue().getLastModified();
        int expires = entry.getValue().getExpires();
        if (Dates.dateCompare(actualDate, lastModified) > expires) {
            connectionClient.deleteUserHyperty(entry.getKey());
        }//from   ww  w.ja v a  2  s .c  o  m
    }
}