Package org.hibernate.stat.internal
Class StatisticsImpl
- java.lang.Object
-
- org.hibernate.stat.internal.StatisticsImpl
-
- All Implemented Interfaces:
Serializable
,Service
,StatisticsImplementor
,Statistics
public class StatisticsImpl extends Object implements StatisticsImplementor, Service
Implementation ofStatistics
based on thejava.util.concurrent
package.- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from interface org.hibernate.stat.Statistics
DEFAULT_QUERY_STATISTICS_MAX_SIZE
-
-
Constructor Summary
Constructors Constructor Description StatisticsImpl(SessionFactoryImplementor sessionFactory)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear()
reset all statisticsvoid
closeSession()
Callback about a session being closed.void
closeStatement()
Callback about a statement being closed.void
collectionCacheHit(NavigableRole collectionRole, String regionName)
Callback indicating a get from second level cache resulted in a hit.void
collectionCacheMiss(NavigableRole collectionRole, String regionName)
Callback indicating a get from second level cache resulted in a miss.void
collectionCachePut(NavigableRole collectionRole, String regionName)
Callback indicating a put into second level cache.void
connect()
Callback about a connection being obtained fromConnectionProvider
void
deleteEntity(String entityName)
Callback about an entity being deleted.void
endTransaction(boolean success)
Callback about a transaction completing.void
entityCacheHit(NavigableRole entityName, String regionName)
Callback indicating a get from second level cache resulted in a hit.void
entityCacheMiss(NavigableRole entityName, String regionName)
Callback indicating a get from second level cache resulted in a miss.void
entityCachePut(NavigableRole entityName, String regionName)
Callback indicating a put into second level cache.void
fetchCollection(String role)
Callback to indicate a collection being fetched.void
fetchEntity(String entityName)
Callback about an entity being fetched.void
flush()
Callback about a flush occurring@Nullable CacheRegionStatisticsImpl
getCacheRegionStatistics(String regionName)
Obtain the statistics for either a domain data or query result cache region.long
getCloseStatementCount()
The number of prepared statements that were released.long
getCollectionFetchCount()
The global number of collections fetched.long
getCollectionLoadCount()
The global number of collections loaded.long
getCollectionRecreateCount()
The global number of collections recreatedlong
getCollectionRemoveCount()
The global number of collections removed.String[]
getCollectionRoleNames()
The names of all collection roles.CollectionStatisticsImpl
getCollectionStatistics(String role)
Obtain the statistics for the collection with the given role.long
getCollectionUpdateCount()
The global number of collections updated.long
getConnectCount()
The global number of connections requested by sessions.CacheRegionStatisticsImpl
getDomainDataRegionStatistics(String regionName)
Obtain the second-level cache statistics for the given cache region.long
getEntityDeleteCount()
The global number of entity deletes.long
getEntityFetchCount()
The global number of entity fetches.long
getEntityInsertCount()
The global number of entity inserts.long
getEntityLoadCount()
The global number of entity loads.String[]
getEntityNames()
The names of all entities.EntityStatisticsImpl
getEntityStatistics(String entityName)
Obtain the statistics for the entity with the given name.long
getEntityUpdateCount()
The global number of entity updates.long
getFlushCount()
The global number of flush operations executed, including automatic (either manual or automatic).long
getNaturalIdCacheHitCount()
The global number of cached natural id lookups successfully retrieved from the cache.long
getNaturalIdCacheMissCount()
The global number of cached natural id lookups not found in the cache.long
getNaturalIdCachePutCount()
The global number of cacheable natural id lookups put in cache.long
getNaturalIdQueryExecutionCount()
The global number of natural id queries executed against the database.long
getNaturalIdQueryExecutionMaxTime()
The global maximum query time for natural id queries executed against the database.@Nullable String
getNaturalIdQueryExecutionMaxTimeEntity()
The entity name for the maximum natural id query time.@Nullable String
getNaturalIdQueryExecutionMaxTimeRegion()
The region for the maximum natural id query time.NaturalIdStatisticsImpl
getNaturalIdStatistics(String rootEntityName)
Obtain the natural id resolution statistics for the entity type with the given name.long
getOptimisticFailureCount()
The number of HibernateStaleObjectStateException
s or JPAOptimisticLockException
s that have occurred.long
getPrepareStatementCount()
The number of prepared statements that were acquired.String[]
getQueries()
All executed query strings.long
getQueryCacheHitCount()
The global number of cached queries successfully retrieved from the cache.long
getQueryCacheMissCount()
The global number of cached queries notnot found in the cache.long
getQueryCachePutCount()
The global number of cacheable queries put in cache.long
getQueryExecutionCount()
The global number of executed queries.long
getQueryExecutionMaxTime()
The time in milliseconds of the slowest query.@Nullable String
getQueryExecutionMaxTimeQueryString()
The query string for the slowest query.long
getQueryPlanCacheHitCount()
The global number of query plans successfully retrieved from cache.long
getQueryPlanCacheMissCount()
The global number of query plans lookups not found in cache.@Nullable CacheRegionStatisticsImpl
getQueryRegionStatistics(String regionName)
Obtain the second-level cache statistics for the given query cache region.QueryStatisticsImpl
getQueryStatistics(String queryString)
Obtain the query statistics for the given query string.long
getSecondLevelCacheHitCount()
The global number of cacheable entities and collections successfully retrieved from the cache.long
getSecondLevelCacheMissCount()
The global number of cacheable entities collections not found in the cache and loaded from the database.long
getSecondLevelCachePutCount()
The global number of cacheable entities and collections put in the cache.String[]
getSecondLevelCacheRegionNames()
All second-level cache region names.long
getSessionCloseCount()
The global number of sessions closed.long
getSessionOpenCount()
The global number of sessions opened.Map<String,Long>
getSlowQueries()
If "hibernate.log_slow_query" is enabled, a map from the SQL query to the maximum execution time in milliseconds.Instant
getStart()
TheInstant
at which this instance ofStatistics
was created, or since the last timeStatistics.clear()
was called.long
getStartTime()
The Instant.toEpochMilli() milliseconds since the initial creation of this instance, or since the last timeStatistics.clear()
was called.long
getSuccessfulTransactionCount()
The number of transactions we know to have been successful.long
getTransactionCount()
The number of transactions we know to have completed.long
getUpdateTimestampsCacheHitCount()
The global number of timestamps successfully retrieved from cache.long
getUpdateTimestampsCacheMissCount()
The global number of timestamp requests that were not found in the cache.long
getUpdateTimestampsCachePutCount()
The global number of timestamps put in cache.void
insertEntity(String entityName)
Callback about an entity being insertedboolean
isStatisticsEnabled()
Is collection of statistics enabled?void
loadCollection(String role)
Callback about a collection loading.void
loadEntity(String entityName)
Callback about an entity being loaded.void
logSummary()
Log the main statistics at levelINFO
.void
naturalIdCacheHit(NavigableRole rootEntityName, String regionName)
Callback indicating a get from natural id cache resulted in a hit.void
naturalIdCacheMiss(NavigableRole rootEntityName, String regionName)
Callback indicating a get from natural id cache resulted in a miss.void
naturalIdCachePut(NavigableRole rootEntityName, String regionName)
Callback indicating a put into natural id cache.void
naturalIdQueryExecuted(String rootEntityName, long time)
Callback indicating execution of a natural id queryvoid
openSession()
Callback about a session being opened.void
optimisticFailure(String entityName)
Callback about an optimistic lock failure on an entityvoid
prepareStatement()
Callback about a statement being prepared.void
queryCacheHit(String hql, String regionName)
Callback indicating a get from the query cache resulted in a hit.void
queryCacheMiss(String hql, String regionName)
Callback indicating a get from the query cache resulted in a miss.void
queryCachePut(String hql, String regionName)
Callback indicating a put into the query cache.void
queryCompiled(String hql, long microseconds)
Callback indicating compilation of a sql/hql queryvoid
queryExecuted(String hql, int rows, long time)
Callback indicating execution of a sql/hql queryvoid
queryPlanCacheHit(String query)
Callback indicating a get from the query plan cache resulted in a hit.void
queryPlanCacheMiss(String query)
Callback indicating a get from the query plan cache resulted in a miss.void
recreateCollection(String role)
Callback indicating a collection recreation (full deletion + full (re-)insertion).void
removeCollection(String role)
Callback indicating a collection removal.void
setStatisticsEnabled(boolean enabled)
Enable or disable statistics collection.void
slowQuery(String sql, long executionTime)
Register the execution of a slow SQL query.String
toString()
void
updateCollection(String role)
Callback indicating a collection was updated.void
updateEntity(String entityName)
Callback about an entity being updated.void
updateTimestampsCacheHit()
Callback indicating a hit to the timestamp cachevoid
updateTimestampsCacheMiss()
Callback indicating a miss to the timestamp cachevoid
updateTimestampsCachePut()
Callback indicating a put to the timestamp cache
-
-
-
Constructor Detail
-
StatisticsImpl
public StatisticsImpl(SessionFactoryImplementor sessionFactory)
-
-
Method Detail
-
clear
public void clear()
reset all statistics- Specified by:
clear
in interfaceStatistics
-
getStart
public Instant getStart()
Description copied from interface:Statistics
TheInstant
at which this instance ofStatistics
was created, or since the last timeStatistics.clear()
was called.- Specified by:
getStart
in interfaceStatistics
-
getStartTime
public long getStartTime()
Description copied from interface:Statistics
The Instant.toEpochMilli() milliseconds since the initial creation of this instance, or since the last timeStatistics.clear()
was called.- Specified by:
getStartTime
in interfaceStatistics
-
isStatisticsEnabled
public boolean isStatisticsEnabled()
Description copied from interface:Statistics
Is collection of statistics enabled?- Specified by:
isStatisticsEnabled
in interfaceStatistics
-
setStatisticsEnabled
public void setStatisticsEnabled(boolean enabled)
Description copied from interface:Statistics
Enable or disable statistics collection.- Specified by:
setStatisticsEnabled
in interfaceStatistics
-
getEntityNames
public String[] getEntityNames()
Description copied from interface:Statistics
The names of all entities.- Specified by:
getEntityNames
in interfaceStatistics
-
getEntityStatistics
public EntityStatisticsImpl getEntityStatistics(String entityName)
Description copied from interface:Statistics
Obtain the statistics for the entity with the given name.- Specified by:
getEntityStatistics
in interfaceStatistics
- Parameters:
entityName
- the entity name
-
getEntityLoadCount
public long getEntityLoadCount()
Description copied from interface:Statistics
The global number of entity loads.- Specified by:
getEntityLoadCount
in interfaceStatistics
-
getEntityFetchCount
public long getEntityFetchCount()
Description copied from interface:Statistics
The global number of entity fetches.- Specified by:
getEntityFetchCount
in interfaceStatistics
-
getEntityDeleteCount
public long getEntityDeleteCount()
Description copied from interface:Statistics
The global number of entity deletes.- Specified by:
getEntityDeleteCount
in interfaceStatistics
-
getEntityInsertCount
public long getEntityInsertCount()
Description copied from interface:Statistics
The global number of entity inserts.- Specified by:
getEntityInsertCount
in interfaceStatistics
-
getEntityUpdateCount
public long getEntityUpdateCount()
Description copied from interface:Statistics
The global number of entity updates.- Specified by:
getEntityUpdateCount
in interfaceStatistics
-
getOptimisticFailureCount
public long getOptimisticFailureCount()
Description copied from interface:Statistics
The number of HibernateStaleObjectStateException
s or JPAOptimisticLockException
s that have occurred.- Specified by:
getOptimisticFailureCount
in interfaceStatistics
-
loadEntity
public void loadEntity(String entityName)
Description copied from interface:StatisticsImplementor
Callback about an entity being loaded. This might indicate a proxy or a fully initialized entity, but in either case it means without a separate SQL query being needed.- Specified by:
loadEntity
in interfaceStatisticsImplementor
- Parameters:
entityName
- The name of the entity loaded.
-
fetchEntity
public void fetchEntity(String entityName)
Description copied from interface:StatisticsImplementor
Callback about an entity being fetched. UnlikeStatisticsImplementor.loadEntity(java.lang.String)
this indicates a separate query being performed.- Specified by:
fetchEntity
in interfaceStatisticsImplementor
- Parameters:
entityName
- The name of the entity fetched.
-
updateEntity
public void updateEntity(String entityName)
Description copied from interface:StatisticsImplementor
Callback about an entity being updated.- Specified by:
updateEntity
in interfaceStatisticsImplementor
- Parameters:
entityName
- The name of the entity updated.
-
insertEntity
public void insertEntity(String entityName)
Description copied from interface:StatisticsImplementor
Callback about an entity being inserted- Specified by:
insertEntity
in interfaceStatisticsImplementor
- Parameters:
entityName
- The name of the entity inserted
-
deleteEntity
public void deleteEntity(String entityName)
Description copied from interface:StatisticsImplementor
Callback about an entity being deleted.- Specified by:
deleteEntity
in interfaceStatisticsImplementor
- Parameters:
entityName
- The name of the entity deleted.
-
optimisticFailure
public void optimisticFailure(String entityName)
Description copied from interface:StatisticsImplementor
Callback about an optimistic lock failure on an entity- Specified by:
optimisticFailure
in interfaceStatisticsImplementor
- Parameters:
entityName
- The name of the entity.
-
entityCachePut
public void entityCachePut(NavigableRole entityName, String regionName)
Description copied from interface:StatisticsImplementor
Callback indicating a put into second level cache.- Specified by:
entityCachePut
in interfaceStatisticsImplementor
-
entityCacheHit
public void entityCacheHit(NavigableRole entityName, String regionName)
Description copied from interface:StatisticsImplementor
Callback indicating a get from second level cache resulted in a hit.- Specified by:
entityCacheHit
in interfaceStatisticsImplementor
-
entityCacheMiss
public void entityCacheMiss(NavigableRole entityName, String regionName)
Description copied from interface:StatisticsImplementor
Callback indicating a get from second level cache resulted in a miss.- Specified by:
entityCacheMiss
in interfaceStatisticsImplementor
-
getCollectionRoleNames
public String[] getCollectionRoleNames()
Description copied from interface:Statistics
The names of all collection roles.- Specified by:
getCollectionRoleNames
in interfaceStatistics
-
getCollectionStatistics
public CollectionStatisticsImpl getCollectionStatistics(String role)
Description copied from interface:Statistics
Obtain the statistics for the collection with the given role.- Specified by:
getCollectionStatistics
in interfaceStatistics
- Parameters:
role
- the collection role
-
getCollectionLoadCount
public long getCollectionLoadCount()
Description copied from interface:Statistics
The global number of collections loaded.- Specified by:
getCollectionLoadCount
in interfaceStatistics
-
getCollectionFetchCount
public long getCollectionFetchCount()
Description copied from interface:Statistics
The global number of collections fetched.- Specified by:
getCollectionFetchCount
in interfaceStatistics
-
getCollectionUpdateCount
public long getCollectionUpdateCount()
Description copied from interface:Statistics
The global number of collections updated.- Specified by:
getCollectionUpdateCount
in interfaceStatistics
-
getCollectionRemoveCount
public long getCollectionRemoveCount()
Description copied from interface:Statistics
The global number of collections removed.- Specified by:
getCollectionRemoveCount
in interfaceStatistics
-
getCollectionRecreateCount
public long getCollectionRecreateCount()
Description copied from interface:Statistics
The global number of collections recreated- Specified by:
getCollectionRecreateCount
in interfaceStatistics
-
loadCollection
public void loadCollection(String role)
Description copied from interface:StatisticsImplementor
Callback about a collection loading. This might indicate a lazy collection or an initialized collection being created, but in either case it means without a separate SQL query being needed.- Specified by:
loadCollection
in interfaceStatisticsImplementor
- Parameters:
role
- The collection role.
-
fetchCollection
public void fetchCollection(String role)
Description copied from interface:StatisticsImplementor
Callback to indicate a collection being fetched. UnlikeStatisticsImplementor.loadCollection(java.lang.String)
, this indicates a separate query was needed.- Specified by:
fetchCollection
in interfaceStatisticsImplementor
- Parameters:
role
- The collection role.
-
updateCollection
public void updateCollection(String role)
Description copied from interface:StatisticsImplementor
Callback indicating a collection was updated.- Specified by:
updateCollection
in interfaceStatisticsImplementor
- Parameters:
role
- The collection role.
-
recreateCollection
public void recreateCollection(String role)
Description copied from interface:StatisticsImplementor
Callback indicating a collection recreation (full deletion + full (re-)insertion).- Specified by:
recreateCollection
in interfaceStatisticsImplementor
- Parameters:
role
- The collection role.
-
removeCollection
public void removeCollection(String role)
Description copied from interface:StatisticsImplementor
Callback indicating a collection removal.- Specified by:
removeCollection
in interfaceStatisticsImplementor
- Parameters:
role
- The collection role.
-
collectionCachePut
public void collectionCachePut(NavigableRole collectionRole, String regionName)
Description copied from interface:StatisticsImplementor
Callback indicating a put into second level cache.- Specified by:
collectionCachePut
in interfaceStatisticsImplementor
- Parameters:
collectionRole
- The collection's "path"regionName
- The name of the cache region
-
collectionCacheHit
public void collectionCacheHit(NavigableRole collectionRole, String regionName)
Description copied from interface:StatisticsImplementor
Callback indicating a get from second level cache resulted in a hit.- Specified by:
collectionCacheHit
in interfaceStatisticsImplementor
- Parameters:
collectionRole
- The collection's "path"regionName
- The name of the cache region
-
collectionCacheMiss
public void collectionCacheMiss(NavigableRole collectionRole, String regionName)
Description copied from interface:StatisticsImplementor
Callback indicating a get from second level cache resulted in a miss.- Specified by:
collectionCacheMiss
in interfaceStatisticsImplementor
- Parameters:
collectionRole
- The collection's "path"regionName
- The name of the cache region
-
getNaturalIdStatistics
public NaturalIdStatisticsImpl getNaturalIdStatistics(String rootEntityName)
Description copied from interface:Statistics
Obtain the natural id resolution statistics for the entity type with the given name.- Specified by:
getNaturalIdStatistics
in interfaceStatistics
- Parameters:
rootEntityName
- The entity name that is the root of the hierarchy containing the natural id
-
getNaturalIdQueryExecutionCount
public long getNaturalIdQueryExecutionCount()
Description copied from interface:Statistics
The global number of natural id queries executed against the database.- Specified by:
getNaturalIdQueryExecutionCount
in interfaceStatistics
-
getNaturalIdQueryExecutionMaxTime
public long getNaturalIdQueryExecutionMaxTime()
Description copied from interface:Statistics
The global maximum query time for natural id queries executed against the database.- Specified by:
getNaturalIdQueryExecutionMaxTime
in interfaceStatistics
-
getNaturalIdQueryExecutionMaxTimeRegion
public @Nullable String getNaturalIdQueryExecutionMaxTimeRegion()
Description copied from interface:Statistics
The region for the maximum natural id query time.- Specified by:
getNaturalIdQueryExecutionMaxTimeRegion
in interfaceStatistics
-
getNaturalIdQueryExecutionMaxTimeEntity
public @Nullable String getNaturalIdQueryExecutionMaxTimeEntity()
Description copied from interface:Statistics
The entity name for the maximum natural id query time.- Specified by:
getNaturalIdQueryExecutionMaxTimeEntity
in interfaceStatistics
-
getNaturalIdCacheHitCount
public long getNaturalIdCacheHitCount()
Description copied from interface:Statistics
The global number of cached natural id lookups successfully retrieved from the cache.- Specified by:
getNaturalIdCacheHitCount
in interfaceStatistics
-
getNaturalIdCacheMissCount
public long getNaturalIdCacheMissCount()
Description copied from interface:Statistics
The global number of cached natural id lookups not found in the cache.- Specified by:
getNaturalIdCacheMissCount
in interfaceStatistics
-
getNaturalIdCachePutCount
public long getNaturalIdCachePutCount()
Description copied from interface:Statistics
The global number of cacheable natural id lookups put in cache.- Specified by:
getNaturalIdCachePutCount
in interfaceStatistics
-
naturalIdCachePut
public void naturalIdCachePut(NavigableRole rootEntityName, String regionName)
Description copied from interface:StatisticsImplementor
Callback indicating a put into natural id cache.- Specified by:
naturalIdCachePut
in interfaceStatisticsImplementor
-
naturalIdCacheHit
public void naturalIdCacheHit(NavigableRole rootEntityName, String regionName)
Description copied from interface:StatisticsImplementor
Callback indicating a get from natural id cache resulted in a hit.- Specified by:
naturalIdCacheHit
in interfaceStatisticsImplementor
-
naturalIdCacheMiss
public void naturalIdCacheMiss(NavigableRole rootEntityName, String regionName)
Description copied from interface:StatisticsImplementor
Callback indicating a get from natural id cache resulted in a miss.- Specified by:
naturalIdCacheMiss
in interfaceStatisticsImplementor
-
naturalIdQueryExecuted
public void naturalIdQueryExecuted(String rootEntityName, long time)
Description copied from interface:StatisticsImplementor
Callback indicating execution of a natural id query- Specified by:
naturalIdQueryExecuted
in interfaceStatisticsImplementor
-
getSecondLevelCacheRegionNames
public String[] getSecondLevelCacheRegionNames()
Description copied from interface:Statistics
All second-level cache region names. For backwards compatibility, this method returns just the names of regions storing domain data, not query result cache regions.- Specified by:
getSecondLevelCacheRegionNames
in interfaceStatistics
-
getDomainDataRegionStatistics
public CacheRegionStatisticsImpl getDomainDataRegionStatistics(String regionName)
Description copied from interface:Statistics
Obtain the second-level cache statistics for the given cache region.- Specified by:
getDomainDataRegionStatistics
in interfaceStatistics
- Parameters:
regionName
- The unqualified region name- Returns:
- the statistics for the named region, or
null
if the second-level cache is not enabled
-
getQueryRegionStatistics
public @Nullable CacheRegionStatisticsImpl getQueryRegionStatistics(String regionName)
Description copied from interface:Statistics
Obtain the second-level cache statistics for the given query cache region.- Specified by:
getQueryRegionStatistics
in interfaceStatistics
- Parameters:
regionName
- The unqualified region name- Returns:
- the statistics for the named region, or
null
if either query result caching is not enabled, or no query cache region exists with the given name
-
getCacheRegionStatistics
public @Nullable CacheRegionStatisticsImpl getCacheRegionStatistics(String regionName)
Description copied from interface:Statistics
Obtain the statistics for either a domain data or query result cache region.This method checks both, preferring the domain data region if there is one. Think of it as a cascading check to:
Note that null is returned instead of throwing an exception when no region exists with the given name.- Specified by:
getCacheRegionStatistics
in interfaceStatistics
- Parameters:
regionName
- The unqualified region name- Returns:
- the statistics for the named region, or
null
if there is no region with the given name
-
getSecondLevelCacheHitCount
public long getSecondLevelCacheHitCount()
Description copied from interface:Statistics
The global number of cacheable entities and collections successfully retrieved from the cache.- Specified by:
getSecondLevelCacheHitCount
in interfaceStatistics
-
getSecondLevelCacheMissCount
public long getSecondLevelCacheMissCount()
Description copied from interface:Statistics
The global number of cacheable entities collections not found in the cache and loaded from the database.- Specified by:
getSecondLevelCacheMissCount
in interfaceStatistics
-
getSecondLevelCachePutCount
public long getSecondLevelCachePutCount()
Description copied from interface:Statistics
The global number of cacheable entities and collections put in the cache.- Specified by:
getSecondLevelCachePutCount
in interfaceStatistics
-
getUpdateTimestampsCacheHitCount
public long getUpdateTimestampsCacheHitCount()
Description copied from interface:Statistics
The global number of timestamps successfully retrieved from cache.- Specified by:
getUpdateTimestampsCacheHitCount
in interfaceStatistics
-
getUpdateTimestampsCacheMissCount
public long getUpdateTimestampsCacheMissCount()
Description copied from interface:Statistics
The global number of timestamp requests that were not found in the cache.- Specified by:
getUpdateTimestampsCacheMissCount
in interfaceStatistics
-
getUpdateTimestampsCachePutCount
public long getUpdateTimestampsCachePutCount()
Description copied from interface:Statistics
The global number of timestamps put in cache.- Specified by:
getUpdateTimestampsCachePutCount
in interfaceStatistics
-
updateTimestampsCacheHit
public void updateTimestampsCacheHit()
Description copied from interface:StatisticsImplementor
Callback indicating a hit to the timestamp cache- Specified by:
updateTimestampsCacheHit
in interfaceStatisticsImplementor
-
updateTimestampsCacheMiss
public void updateTimestampsCacheMiss()
Description copied from interface:StatisticsImplementor
Callback indicating a miss to the timestamp cache- Specified by:
updateTimestampsCacheMiss
in interfaceStatisticsImplementor
-
updateTimestampsCachePut
public void updateTimestampsCachePut()
Description copied from interface:StatisticsImplementor
Callback indicating a put to the timestamp cache- Specified by:
updateTimestampsCachePut
in interfaceStatisticsImplementor
-
getQueries
public String[] getQueries()
Description copied from interface:Statistics
All executed query strings.The maximum number of queries tracked by the Hibernate statistics is determined by the configuration property "hibernate.statistics.query_max_size".
- Specified by:
getQueries
in interfaceStatistics
- See Also:
StatisticsSettings.QUERY_STATISTICS_MAX_SIZE
-
getQueryStatistics
public QueryStatisticsImpl getQueryStatistics(String queryString)
Description copied from interface:Statistics
Obtain the query statistics for the given query string.- Specified by:
getQueryStatistics
in interfaceStatistics
- Parameters:
queryString
- the query string, written in HQL or SQL
-
getQueryExecutionCount
public long getQueryExecutionCount()
Description copied from interface:Statistics
The global number of executed queries.- Specified by:
getQueryExecutionCount
in interfaceStatistics
-
getQueryCacheHitCount
public long getQueryCacheHitCount()
Description copied from interface:Statistics
The global number of cached queries successfully retrieved from the cache.- Specified by:
getQueryCacheHitCount
in interfaceStatistics
-
getQueryCacheMissCount
public long getQueryCacheMissCount()
Description copied from interface:Statistics
The global number of cached queries notnot found in the cache.- Specified by:
getQueryCacheMissCount
in interfaceStatistics
-
getQueryCachePutCount
public long getQueryCachePutCount()
Description copied from interface:Statistics
The global number of cacheable queries put in cache.- Specified by:
getQueryCachePutCount
in interfaceStatistics
-
getQueryExecutionMaxTimeQueryString
public @Nullable String getQueryExecutionMaxTimeQueryString()
Description copied from interface:Statistics
The query string for the slowest query.- Specified by:
getQueryExecutionMaxTimeQueryString
in interfaceStatistics
-
getQueryExecutionMaxTime
public long getQueryExecutionMaxTime()
Description copied from interface:Statistics
The time in milliseconds of the slowest query.- Specified by:
getQueryExecutionMaxTime
in interfaceStatistics
-
queryExecuted
public void queryExecuted(String hql, int rows, long time)
Description copied from interface:StatisticsImplementor
Callback indicating execution of a sql/hql query- Specified by:
queryExecuted
in interfaceStatisticsImplementor
- Parameters:
hql
- The queryrows
- Number of rows returnedtime
- execution time
-
queryCacheHit
public void queryCacheHit(String hql, String regionName)
Description copied from interface:StatisticsImplementor
Callback indicating a get from the query cache resulted in a hit.- Specified by:
queryCacheHit
in interfaceStatisticsImplementor
- Parameters:
hql
- The queryregionName
- The name of the cache region
-
queryCacheMiss
public void queryCacheMiss(String hql, String regionName)
Description copied from interface:StatisticsImplementor
Callback indicating a get from the query cache resulted in a miss.- Specified by:
queryCacheMiss
in interfaceStatisticsImplementor
- Parameters:
hql
- The queryregionName
- The name of the cache region
-
queryCachePut
public void queryCachePut(String hql, String regionName)
Description copied from interface:StatisticsImplementor
Callback indicating a put into the query cache.- Specified by:
queryCachePut
in interfaceStatisticsImplementor
- Parameters:
hql
- The queryregionName
- The cache region
-
getQueryPlanCacheHitCount
public long getQueryPlanCacheHitCount()
Description copied from interface:Statistics
The global number of query plans successfully retrieved from cache.- Specified by:
getQueryPlanCacheHitCount
in interfaceStatistics
-
getQueryPlanCacheMissCount
public long getQueryPlanCacheMissCount()
Description copied from interface:Statistics
The global number of query plans lookups not found in cache.- Specified by:
getQueryPlanCacheMissCount
in interfaceStatistics
-
queryCompiled
public void queryCompiled(String hql, long microseconds)
Description copied from interface:StatisticsImplementor
Callback indicating compilation of a sql/hql query- Specified by:
queryCompiled
in interfaceStatisticsImplementor
- Parameters:
hql
- The querymicroseconds
- execution time
-
queryPlanCacheHit
public void queryPlanCacheHit(String query)
Description copied from interface:StatisticsImplementor
Callback indicating a get from the query plan cache resulted in a hit.- Specified by:
queryPlanCacheHit
in interfaceStatisticsImplementor
- Parameters:
query
- The query
-
queryPlanCacheMiss
public void queryPlanCacheMiss(String query)
Description copied from interface:StatisticsImplementor
Callback indicating a get from the query plan cache resulted in a miss.- Specified by:
queryPlanCacheMiss
in interfaceStatisticsImplementor
- Parameters:
query
- The query
-
getSessionOpenCount
public long getSessionOpenCount()
Description copied from interface:Statistics
The global number of sessions opened.- Specified by:
getSessionOpenCount
in interfaceStatistics
-
getSessionCloseCount
public long getSessionCloseCount()
Description copied from interface:Statistics
The global number of sessions closed.- Specified by:
getSessionCloseCount
in interfaceStatistics
-
getFlushCount
public long getFlushCount()
Description copied from interface:Statistics
The global number of flush operations executed, including automatic (either manual or automatic).- Specified by:
getFlushCount
in interfaceStatistics
-
getConnectCount
public long getConnectCount()
Description copied from interface:Statistics
The global number of connections requested by sessions.The actual number of connections used may be much smaller, assuming that a connection pool is in use.
- Specified by:
getConnectCount
in interfaceStatistics
-
getSuccessfulTransactionCount
public long getSuccessfulTransactionCount()
Description copied from interface:Statistics
The number of transactions we know to have been successful.- Specified by:
getSuccessfulTransactionCount
in interfaceStatistics
-
getTransactionCount
public long getTransactionCount()
Description copied from interface:Statistics
The number of transactions we know to have completed.- Specified by:
getTransactionCount
in interfaceStatistics
-
getCloseStatementCount
public long getCloseStatementCount()
Description copied from interface:Statistics
The number of prepared statements that were released.- Specified by:
getCloseStatementCount
in interfaceStatistics
-
getPrepareStatementCount
public long getPrepareStatementCount()
Description copied from interface:Statistics
The number of prepared statements that were acquired.- Specified by:
getPrepareStatementCount
in interfaceStatistics
-
openSession
public void openSession()
Description copied from interface:StatisticsImplementor
Callback about a session being opened.- Specified by:
openSession
in interfaceStatisticsImplementor
-
closeSession
public void closeSession()
Description copied from interface:StatisticsImplementor
Callback about a session being closed.- Specified by:
closeSession
in interfaceStatisticsImplementor
-
flush
public void flush()
Description copied from interface:StatisticsImplementor
Callback about a flush occurring- Specified by:
flush
in interfaceStatisticsImplementor
-
connect
public void connect()
Description copied from interface:StatisticsImplementor
Callback about a connection being obtained fromConnectionProvider
- Specified by:
connect
in interfaceStatisticsImplementor
-
prepareStatement
public void prepareStatement()
Description copied from interface:StatisticsImplementor
Callback about a statement being prepared.- Specified by:
prepareStatement
in interfaceStatisticsImplementor
-
closeStatement
public void closeStatement()
Description copied from interface:StatisticsImplementor
Callback about a statement being closed.- Specified by:
closeStatement
in interfaceStatisticsImplementor
-
endTransaction
public void endTransaction(boolean success)
Description copied from interface:StatisticsImplementor
Callback about a transaction completing.- Specified by:
endTransaction
in interfaceStatisticsImplementor
- Parameters:
success
- Was the transaction successful?
-
logSummary
public void logSummary()
Description copied from interface:Statistics
Log the main statistics at levelINFO
.- Specified by:
logSummary
in interfaceStatistics
-
getSlowQueries
public Map<String,Long> getSlowQueries()
Description copied from interface:Statistics
If "hibernate.log_slow_query" is enabled, a map from the SQL query to the maximum execution time in milliseconds.- Specified by:
getSlowQueries
in interfaceStatistics
- Specified by:
getSlowQueries
in interfaceStatisticsImplementor
- See Also:
JdbcSettings.LOG_SLOW_QUERY
-
slowQuery
public void slowQuery(String sql, long executionTime)
Description copied from interface:StatisticsImplementor
Register the execution of a slow SQL query.- Specified by:
slowQuery
in interfaceStatisticsImplementor
-
-