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.codenvy.cli.preferences.file.JsonPreferences.java

@JsonCreator
protected JsonPreferences(Map<String, Object> innerPreferences) {
    this.callbackList = new ArrayList<>();
    this.innerPreferences = new ConcurrentHashMap<String, Object>(innerPreferences);

    this.mapper = new ObjectMapper();
    this.mapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
    this.mapper.setVisibility(PropertyAccessor.ALL, Visibility.NONE);
    this.mapper.setVisibility(PropertyAccessor.FIELD, Visibility.ANY);
    this.mapper.setVisibility(PropertyAccessor.GETTER, Visibility.PUBLIC_ONLY);
    this.mapper.setVisibility(PropertyAccessor.IS_GETTER, Visibility.PUBLIC_ONLY);

    this.mapType = this.mapper.getTypeFactory().constructMapType(ConcurrentMap.class, String.class,
            Object.class);
}

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

public static String validateServer(List<ClusterNodes> nodes) {
    StringBuilder sb = new StringBuilder();
    ConcurrentMap<String, Short> map = new ConcurrentHashMap<String, Short>(nodes.size());
    for (ClusterNodes node : nodes) {
        for (int i = 0; i < node.getServerArray().length; i++) {
            if (map.putIfAbsent(node.getServerArray()[i], node.getId()) != null)
                sb.append(" id =" + node.getId());
        }//from w w  w.j ava2s .com
    }
    return sb.toString();
}

From source file:com.eharmony.services.swagger.persistence.FileDashboardRepository.java

/**
 * Initializes dashboard map by reading json file from file system.
 * @throws IOException Unable to load the file.
 *//*from  w ww. jav  a  2 s . co m*/
@PostConstruct
public void initializeDashboardnMap() throws IOException {
    if (StringUtils.isEmpty(this.fileLocation)) {
        this.fileLocation = DEFAULT_FILE_LOCATION;
    }
    dashboardMap = new ConcurrentHashMap<>(readDashboardFromFile());
}

From source file:org.siddhiesb.transport.http.conn.ServerConnFactory.java

public ServerConnFactory(final HttpRequestFactory requestFactory, final ByteBufferAllocator allocator,
        final org.siddhiesb.transport.http.conn.SSLContextDetails ssl,
        final Map<InetSocketAddress, org.siddhiesb.transport.http.conn.SSLContextDetails> sslByIPMap,
        final HttpParams params) {
    super();/*from   w w  w.  j  a v  a  2  s  .c  o  m*/
    this.requestFactory = requestFactory != null ? requestFactory : new DefaultHttpRequestFactory();
    this.allocator = allocator != null ? allocator : new HeapByteBufferAllocator();
    this.ssl = ssl;
    this.sslByIPMap = sslByIPMap != null
            ? new ConcurrentHashMap<InetSocketAddress, org.siddhiesb.transport.http.conn.SSLContextDetails>(
                    sslByIPMap)
            : null;
    this.params = params != null ? params : new BasicHttpParams();
}

From source file:ch.algotrader.adapter.fix.FixMultiApplicationSessionFactory.java

public FixMultiApplicationSessionFactory(final Map<String, FixApplicationFactory> applicationFactoryMap,
        final MessageStoreFactory messageStoreFactory, final MessageFactory messageFactory) {

    Validate.notNull(applicationFactoryMap, "FixApplicationFactory map may not be null");
    Validate.notNull(messageStoreFactory, "MessageStoreFactory may not be null");
    Validate.notNull(messageFactory, "MessageFactory may not be null");

    this.applicationFactoryMap = new ConcurrentHashMap<>(applicationFactoryMap);
    this.messageStoreFactory = messageStoreFactory;
    this.messageFactory = messageFactory;
}

From source file:gridool.dht.impl.TcHashLocalDirectory.java

public TcHashLocalDirectory(LockManager lockManger) {
    super(lockManger);
    this.map = new ConcurrentHashMap<String, HDB>(16);
}

From source file:net.solarnetwork.node.weather.nz.metservice.MetserviceSupport.java

public MetserviceSupport() {
    datumCache = new ConcurrentHashMap<String, T>(2);
    baseUrl = DEFAULT_BASE_URL;
}

From source file:ch.algotrader.service.SimpleOrderServiceImpl.java

public SimpleOrderServiceImpl(final CommonConfig commonConfig, final Engine serverEngine,
        final EventDispatcher eventDispatcher,
        final Map<String, SimpleOrderExecService> externalOrderServiceMap) {

    Validate.notNull(commonConfig, "CommonConfig is null");
    Validate.notNull(serverEngine, "Engine is null");
    Validate.notNull(eventDispatcher, "EventDispatcher is null");

    this.commonConfig = commonConfig;
    this.serverEngine = serverEngine;
    this.eventDispatcher = eventDispatcher;
    this.externalOrderServiceMap = new ConcurrentHashMap<>(externalOrderServiceMap);
}

From source file:org.siddhiesb.transport.http.conn.ClientConnFactory.java

public ClientConnFactory(final HttpResponseFactory responseFactory, final ByteBufferAllocator allocator,
        final SSLContextDetails ssl, final Map<String, SSLContext> sslByHostMap, final HttpParams params) {
    super();/*www. j a v a  2 s  .c o  m*/
    this.responseFactory = responseFactory != null ? responseFactory : new DefaultHttpResponseFactory();
    this.allocator = allocator != null ? allocator : new HeapByteBufferAllocator();
    this.ssl = ssl;
    this.sslByHostMap = sslByHostMap != null ? new ConcurrentHashMap<String, SSLContext>(sslByHostMap) : null;
    this.params = params != null ? params : new BasicHttpParams();
}

From source file:ch.algotrader.marketdata.MarketDataSubscriber.java

public MarketDataSubscriber(final EventDispatcher eventDispatcher, final LookupService lookupService,
        final MarketDataService marketDataService, final Map<String, String> sessionToFeedTypeMap) {

    Validate.notNull(eventDispatcher, "EventDispatcher is null");
    Validate.notNull(lookupService, "LookupService is null");
    Validate.notNull(marketDataService, "MarketDataService is null");

    this.eventDispatcher = eventDispatcher;
    this.lookupService = lookupService;
    this.marketDataService = marketDataService;
    this.sessionToFeedTypeMap = new ConcurrentHashMap<>(sessionToFeedTypeMap);
    this.executorService = Executors
            .newSingleThreadExecutor(new BasicThreadFactory("Market-data-subscriber-thread", true));
}