From 94e79944b812e3443052a33741c773c9272639e0 Mon Sep 17 00:00:00 2001 From: Strong Liu Date: Wed, 29 Feb 2012 10:42:03 +0800 Subject: [PATCH] HHH-5927 remove logging guard and correct javadoc --- .../engine/query/spi/QueryPlanCache.java | 21 ++++++++----------- .../collections/BoundedConcurrentHashMap.java | 11 +++++----- 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/hibernate-core/src/main/java/org/hibernate/engine/query/spi/QueryPlanCache.java b/hibernate-core/src/main/java/org/hibernate/engine/query/spi/QueryPlanCache.java index 3a179d6122..fd0f4fb438 100644 --- a/hibernate-core/src/main/java/org/hibernate/engine/query/spi/QueryPlanCache.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/query/spi/QueryPlanCache.java @@ -47,8 +47,8 @@ /** * Acts as a cache for compiled query plans, as well as query-parameter metadata. * - * @see Environment#QUERY_PLAN_CACHE_MAX_STRONG_REFERENCES - * @see Environment#QUERY_PLAN_CACHE_MAX_SOFT_REFERENCES + * @see Environment#QUERY_PLAN_CACHE_PARAMETER_METADATA_MAX_SIZE + * @see Environment#QUERY_PLAN_CACHE_MAX_SIZE * * @author Steve Ebersole */ @@ -56,7 +56,6 @@ public class QueryPlanCache implements Serializable { private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, QueryPlanCache.class.getName()); - private static final boolean isTraceEnabled = LOG.isTraceEnabled(); /** * The default strong reference count. */ @@ -164,11 +163,11 @@ public HQLQueryPlan getHQLQueryPlan( String queryString, boolean shallow, Map en HQLQueryPlanKey key = new HQLQueryPlanKey( queryString, shallow, enabledFilters ); HQLQueryPlan value = (HQLQueryPlan) queryPlanCache.get( key ); if ( value == null ) { - if( isTraceEnabled ) LOG.tracev( "Unable to locate HQL query plan in cache; generating ({0})", queryString ); + LOG.tracev( "Unable to locate HQL query plan in cache; generating ({0})", queryString ); value = new HQLQueryPlan( queryString, shallow, enabledFilters, factory ); queryPlanCache.putIfAbsent( key, value ); } else { - if( isTraceEnabled ) LOG.tracev( "Located HQL query plan in cache ({0})", queryString ); + LOG.tracev( "Located HQL query plan in cache ({0})", queryString ); } return value; } @@ -180,12 +179,12 @@ public FilterQueryPlan getFilterQueryPlan(String filterString, String collection FilterQueryPlanKey key = new FilterQueryPlanKey( filterString, collectionRole, shallow, enabledFilters ); FilterQueryPlan value = (FilterQueryPlan) queryPlanCache.get( key ); if(value == null){ - if( isTraceEnabled ) LOG.tracev( "Unable to locate collection-filter query plan in cache; generating ({0} : {1} )", + LOG.tracev( "Unable to locate collection-filter query plan in cache; generating ({0} : {1} )", collectionRole, filterString ); value = new FilterQueryPlan( filterString, collectionRole, shallow, enabledFilters,factory ); queryPlanCache.putIfAbsent( key, value ); } else { - if( isTraceEnabled ) LOG.tracev( "Located collection-filter query plan in cache ({0} : {1})", collectionRole, filterString ); + LOG.tracev( "Located collection-filter query plan in cache ({0} : {1})", collectionRole, filterString ); } return value; } @@ -193,11 +192,11 @@ public FilterQueryPlan getFilterQueryPlan(String filterString, String collection public NativeSQLQueryPlan getNativeSQLQueryPlan(final NativeSQLQuerySpecification spec) { NativeSQLQueryPlan value = (NativeSQLQueryPlan) queryPlanCache.get( spec ); if(value == null){ - if( isTraceEnabled ) LOG.tracev( "Unable to locate native-sql query plan in cache; generating ({0})", spec.getQueryString() ); + LOG.tracev( "Unable to locate native-sql query plan in cache; generating ({0})", spec.getQueryString() ); value = new NativeSQLQueryPlan( spec, factory); queryPlanCache.putIfAbsent( spec, value ); } else { - if( isTraceEnabled ) LOG.tracev( "Located native-sql query plan in cache ({0})", spec.getQueryString() ); + LOG.tracev( "Located native-sql query plan in cache ({0})", spec.getQueryString() ); } return value; } @@ -205,9 +204,7 @@ public NativeSQLQueryPlan getNativeSQLQueryPlan(final NativeSQLQuerySpecificatio //clean up QueryPlanCache when Sessionfactory is closed public void cleanup() { - if ( isTraceEnabled ) { - LOG.trace( "Cleaning QueryPlan Cache" ); - } + LOG.trace( "Cleaning QueryPlan Cache" ); queryPlanCache.clear(); parameterMetadataCache.clear(); } diff --git a/hibernate-core/src/main/java/org/hibernate/internal/util/collections/BoundedConcurrentHashMap.java b/hibernate-core/src/main/java/org/hibernate/internal/util/collections/BoundedConcurrentHashMap.java index 8c86d4fedc..b146001219 100644 --- a/hibernate-core/src/main/java/org/hibernate/internal/util/collections/BoundedConcurrentHashMap.java +++ b/hibernate-core/src/main/java/org/hibernate/internal/util/collections/BoundedConcurrentHashMap.java @@ -90,14 +90,15 @@ * optional methods of the {@link Map} and {@link Iterator} * interfaces. * + *

This class is copied from Infinispan, and was originally written + * by Doug Lea with assistance from members of JCP JSR-166 Expert Group and + * released to the public domain, as explained at + * http://creativecommons.org/licenses/publicdomain

+ * + * *

Like {@link Hashtable} but unlike {@link HashMap}, this class * does not allow null to be used as a key or value. * - *

This class is a member of the - * - * Java Collections Framework. - * - * @since 1.5 * @author Doug Lea * @param the type of keys maintained by this map * @param the type of mapped values