From b3b8ef6073ecfd630c509b2f71e8f8f94cc10994 Mon Sep 17 00:00:00 2001 From: Gavin King Date: Sat, 22 Jan 2022 12:45:35 +0100 Subject: [PATCH] move DEFAULT_QUERY_PLAN_MAX_COUNT to QueryEngine which helps clean up the Javadoc for AvailableSettings --- .../org/hibernate/cfg/AvailableSettings.java | 10 ++++++---- .../QueryInterpretationCacheStandardImpl.java | 13 ------------- .../org/hibernate/query/spi/QueryEngine.java | 16 +++++++++++++++- 3 files changed, 21 insertions(+), 18 deletions(-) diff --git a/hibernate-core/src/main/java/org/hibernate/cfg/AvailableSettings.java b/hibernate-core/src/main/java/org/hibernate/cfg/AvailableSettings.java index 189c43225d..d9cc00686f 100644 --- a/hibernate-core/src/main/java/org/hibernate/cfg/AvailableSettings.java +++ b/hibernate-core/src/main/java/org/hibernate/cfg/AvailableSettings.java @@ -1257,21 +1257,23 @@ public interface AvailableSettings { /** * The maximum number of entries in the - * {@linkplain org.hibernate.query.spi.QueryPlanCache query plan cache}. + * {@linkplain org.hibernate.query.spi.QueryPlanCache query plan cache} or + * {@linkplain org.hibernate.query.spi.QueryInterpretationCache + * query interpretation cache}. *

* The default maximum is - * {@value org.hibernate.query.internal.QueryInterpretationCacheStandardImpl#DEFAULT_QUERY_PLAN_MAX_COUNT}. + * {@value org.hibernate.query.spi.QueryEngine#DEFAULT_QUERY_PLAN_MAX_COUNT}. * * @see org.hibernate.query.spi.QueryPlanCache */ String QUERY_PLAN_CACHE_MAX_SIZE = "hibernate.query.plan_cache_max_size"; /** - * The maximum number of {@link org.hibernate.query.internal.ParameterMetadataImpl} + * The maximum number of {@link org.hibernate.query.ParameterMetadata} instances * maintained by the {@link org.hibernate.query.spi.QueryInterpretationCache}. *

* The default maximum is - * {@value org.hibernate.query.internal.QueryInterpretationCacheStandardImpl#DEFAULT_PARAMETER_METADATA_MAX_COUNT}. + * {@value org.hibernate.query.spi.QueryEngine#DEFAULT_PARAMETER_METADATA_MAX_COUNT}. * * @deprecated this setting is not currently used */ diff --git a/hibernate-core/src/main/java/org/hibernate/query/internal/QueryInterpretationCacheStandardImpl.java b/hibernate-core/src/main/java/org/hibernate/query/internal/QueryInterpretationCacheStandardImpl.java index 32e9f0a170..407fcfc432 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/internal/QueryInterpretationCacheStandardImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/query/internal/QueryInterpretationCacheStandardImpl.java @@ -34,19 +34,6 @@ import org.jboss.logging.Logger; public class QueryInterpretationCacheStandardImpl implements QueryInterpretationCache { private static final Logger log = QueryLogging.subLogger( "plan.cache" ); - /** - * The default strong reference count. - * - * @deprecated No longer used - */ - @Deprecated - public static final int DEFAULT_PARAMETER_METADATA_MAX_COUNT = 128; - - /** - * The default soft reference count. - */ - public static final int DEFAULT_QUERY_PLAN_MAX_COUNT = 2048; - /** * the cache of the actual plans... */ diff --git a/hibernate-core/src/main/java/org/hibernate/query/spi/QueryEngine.java b/hibernate-core/src/main/java/org/hibernate/query/spi/QueryEngine.java index bb68555fa1..0b30aae134 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/spi/QueryEngine.java +++ b/hibernate-core/src/main/java/org/hibernate/query/spi/QueryEngine.java @@ -56,6 +56,20 @@ import org.jboss.logging.Logger; */ @Incubating public class QueryEngine { + + /** + * The default soft reference count. + */ + public static final int DEFAULT_QUERY_PLAN_MAX_COUNT = 2048; + + /** + * The default strong reference count. + * + * @deprecated No longer used + */ + @Deprecated + public static final int DEFAULT_PARAMETER_METADATA_MAX_COUNT = 128; + private static final Logger LOG_HQL_FUNCTIONS = CoreLogging.logger( "org.hibernate.HQL_FUNCTIONS" ); public static QueryEngine from(SessionFactoryImplementor sessionFactory, MetadataImplementor metadata) { @@ -356,7 +370,7 @@ public class QueryEngine { if ( explicitUseCache || ( explicitMaxPlanSize != null && explicitMaxPlanSize > 0 ) ) { final int size = explicitMaxPlanSize != null ? explicitMaxPlanSize - : QueryInterpretationCacheStandardImpl.DEFAULT_QUERY_PLAN_MAX_COUNT; + : DEFAULT_QUERY_PLAN_MAX_COUNT; return new QueryInterpretationCacheStandardImpl( size, statisticsSupplier ); }