Example usage for org.hibernate.internal.util.collections BoundedConcurrentHashMap BoundedConcurrentHashMap

List of usage examples for org.hibernate.internal.util.collections BoundedConcurrentHashMap BoundedConcurrentHashMap

Introduction

In this page you can find the example usage for org.hibernate.internal.util.collections BoundedConcurrentHashMap BoundedConcurrentHashMap.

Prototype

public BoundedConcurrentHashMap(int capacity, int concurrencyLevel, Eviction evictionStrategy) 

Source Link

Document

Creates a new, empty map with the specified maximum capacity, load factor, concurrency level and eviction strategy.

Usage

From source file:com.blazebit.persistence.integration.hibernate.base.HibernateExtendedQuerySupport.java

License:Apache License

private BoundedConcurrentHashMap<QueryPlanCacheKey, HQLQueryPlan> getQueryPlanCache(
        SessionFactoryImplementor sfi) {
    BoundedConcurrentHashMap<QueryPlanCacheKey, HQLQueryPlan> queryPlanCache = queryPlanCachesCache.get(sfi);
    if (queryPlanCache == null) {
        queryPlanCache = new BoundedConcurrentHashMap<QueryPlanCacheKey, HQLQueryPlan>(
                QueryPlanCache.DEFAULT_QUERY_PLAN_MAX_COUNT, 20, BoundedConcurrentHashMap.Eviction.LIRS);
        BoundedConcurrentHashMap<QueryPlanCacheKey, HQLQueryPlan> oldQueryPlanCache = queryPlanCachesCache
                .putIfAbsent(sfi, queryPlanCache);
        if (oldQueryPlanCache != null) {
            queryPlanCache = oldQueryPlanCache;
        }/*from  w  ww .ja va2 s  .co m*/
    }

    return queryPlanCache;
}