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(int initialCapacity, float loadFactor, int concurrencyLevel) 

Source Link

Document

Creates a new, empty map with an initial table size based on the given number of elements ( initialCapacity ), initial table density ( loadFactor ), and number of concurrently updating threads ( concurrencyLevel ).

Usage

From source file:Main.java

public static <K, V> ConcurrentMap<K, V> createConcurrentMap(int initial_capacity, float load_factor,
        int concurrency_level) {
    return new ConcurrentHashMap<K, V>(initial_capacity, load_factor, concurrency_level);
}

From source file:Main.java

public static <K, V> ConcurrentMap<K, V> createConcurrentMap() {
    return new ConcurrentHashMap<K, V>(CCHM_INITIAL_CAPACITY, CCHM_LOAD_FACTOR, CCHM_CONCURRENCY_LEVEL);
}

From source file:Main.java

public static <K, V> ConcurrentHashMap<K, V> newConcurrentHashMap(final int initialCapacity,
        final float loadFactor, final int concurrencyLevel) {
    return new ConcurrentHashMap<K, V>(initialCapacity, loadFactor, concurrencyLevel);
}

From source file:org.powertac.common.repo.WeatherReportRepo.java

/** standard constructor */
public WeatherReportRepo() {
    super();//from w  w w.  ja  v a 2  s . co  m
    indexedWeatherReports = new ConcurrentHashMap<Integer, WeatherReport>(2000, 0.9f, 1);
}

From source file:org.powertac.common.repo.WeatherForecastRepo.java

/** standard constructor */
public WeatherForecastRepo() {
    super();// w  w  w.j a  va  2 s . c om
    indexedWeatherForecasts = new ConcurrentHashMap<Integer, WeatherForecast>(2000, 0.9f, 1);
}

From source file:com.baosight.buapx.ticketregistry.DefaultTicketRegistry.java

/**
 * Creates a new, empty registry with the specified initial capacity, load
 * factor, and concurrency level.//from ww  w  .j av a  2  s .c  o m
 * 
 * @param initialCapacity - the initial capacity. The implementation
 * performs internal sizing to accommodate this many elements.
 * @param loadFactor - the load factor threshold, used to control resizing.
 * Resizing may be performed when the average number of elements per bin
 * exceeds this threshold.
 * @param concurrencyLevel - the estimated number of concurrently updating
 * threads. The implementation performs internal sizing to try to
 * accommodate this many threads.
 */
public DefaultTicketRegistry(int initialCapacity, final float loadFactor, final int concurrencyLevel) {
    this.cache = new ConcurrentHashMap<String, Ticket>(initialCapacity, loadFactor, concurrencyLevel);
}

From source file:com.fluidops.iwb.cache.ImageFileCache.java

/**
 * Constructor
 */
private ImageFileCache() {
    cache = new ConcurrentHashMap<String, Map<String, String>>(16, 0.75f, 2);
}

From source file:com.github.lightdocs.model.Operation.java

public Operation(HttpMethod method, String _path) {
    httpMethod = Validate.notNull(method);
    path = Validate.notNull(_path);/*from  ww w  . j a v  a 2 s  . c  o  m*/

    queryParameters = new ConcurrentHashMap<String, Parameter>(8, 0.9f, 1);
    pathParameters = new ConcurrentHashMap<String, Parameter>(8, 0.9f, 1);
    headerParameters = new ConcurrentHashMap<String, Parameter>(8, 0.9f, 1);
    acceptedContentTypes = new ArrayList<String>();
    producedContentTypes = new ArrayList<String>();

}

From source file:com.fluidops.iwb.cache.ImageFileCache.java

/**
 * (Re)-initialization of data structure, clears the cache.
 *//*  ww  w.  j a v  a 2 s. co  m*/
public void invalidate() {
    cache.clear();
    cache = new ConcurrentHashMap<String, Map<String, String>>(16, 0.75f, 2);
}

From source file:com.connectsdk.discovery.provider.CastDiscoveryProvider.java

public CastDiscoveryProvider(Context context) {
    mMediaRouter = MediaRouter.getInstance(context);
    mMediaRouteSelector = new MediaRouteSelector.Builder().addControlCategory(CastMediaControlIntent
            .categoryForCast(CastMediaControlIntent.DEFAULT_MEDIA_RECEIVER_APPLICATION_ID)).build();

    mMediaRouterCallback = new MediaRouterCallback();

    foundServices = new ConcurrentHashMap<String, ServiceDescription>(8, 0.75f, 2);
    serviceListeners = new CopyOnWriteArrayList<DiscoveryProviderListener>();
}