Top Description Fields Constructors Methods
org.hibernate.stat.internal

public Class StatisticsImpl

extends Object
implements StatisticsImplementor, Service, Manageable
Class Inheritance
All Implemented Interfaces
org.hibernate.service.spi.Manageable, org.hibernate.service.Service, java.io.Serializable, org.hibernate.stat.spi.StatisticsImplementor, org.hibernate.stat.Statistics
Annotations
@SuppressWarnings:unchecked
Imports
java.util.Objects, java.util.concurrent.atomic.AtomicLong, .LongAdder, org.hibernate.boot.spi.SessionFactoryOptions, org.hibernate.cache.spi.CacheImplementor, .QueryResultsCache, .QueryResultsRegion, .Region, org.hibernate.engine.spi.SessionFactoryImplementor, org.hibernate.internal.CoreMessageLogger, org.hibernate.metamodel.model.domain.NavigableRole, org.hibernate.metamodel.spi.MetamodelImplementor, org.hibernate.persister.entity.EntityPersister, org.hibernate.service.Service, org.hibernate.service.spi.Manageable, org.hibernate.stat.Statistics, org.hibernate.stat.spi.StatisticsImplementor

Deprecated

as a consequence of Manageable being deprecated. See corresponding docs for further information.

Implementation of org.hibernate.stat.Statistics based on the java.util.concurrent package.
Authors
Alex Snaps, Sanne Grinovero

Field Summary

Modifier and TypeField and Description
private final CacheImplementor
cache

Deprecated as a consequence of CacheImplementor being deprecated.
private final String
private final LongAdder
private final LongAdder
private final LongAdder
private final LongAdder
private final LongAdder
private final StatsNamedContainer<CollectionStatisticsImpl>
private final LongAdder
private final LongAdder
private final LongAdder
private final StatsNamedContainer<DeprecatedNaturalIdCacheStatisticsImpl>
private final LongAdder
private final LongAdder
private final LongAdder
private final LongAdder
private final StatsNamedContainer<EntityStatisticsImpl>
private final LongAdder
private final LongAdder
private volatile boolean
private final StatsNamedContainer<CacheRegionStatisticsImpl>
l2CacheStatsMap

Keyed by region name

private static final CoreMessageLogger
private final MetamodelImplementor
private final LongAdder
private final LongAdder
private final LongAdder
private final LongAdder
private final AtomicLong
private volatile String
private volatile String
private final StatsNamedContainer<NaturalIdStatisticsImpl>
private final LongAdder
private final LongAdder
private final boolean
private final LongAdder
private final LongAdder
private final LongAdder
private final LongAdder
private final AtomicLong
private volatile String
private final LongAdder
private final LongAdder
private final StatsNamedContainer<QueryStatisticsImpl>
queryStatsMap

Keyed by query string

private final boolean
private final LongAdder
private final LongAdder
private final LongAdder
private final LongAdder
private final LongAdder
private volatile long
private final LongAdder
private final LongAdder
private final LongAdder
private final LongAdder

Constructor Summary

AccessConstructor and Description
public
StatisticsImpl(SessionFactoryImplementor sessionFactory)

Deprecated as a consequence of SessionFactoryImplementor being deprecated.

Method Summary

Modifier and TypeMethod and Description
public void
clear()

Implements org.hibernate.stat.Statistics.clear.

reset all statistics
public void
closeSession()

Implements org.hibernate.stat.spi.StatisticsImplementor.closeSession.

Callback about a session being closed.
public void
closeStatement()

Implements org.hibernate.stat.spi.StatisticsImplementor.closeStatement.

Callback about a statement being closed.
public void
collectionCacheHit(NavigableRole
The collection's "path"
collectionRole
,
String
The name of the cache region
regionName
)

Implements org.hibernate.stat.spi.StatisticsImplementor.collectionCacheHit.

Callback indicating a get from second level cache resulted in a hit.
public void
collectionCacheMiss(NavigableRole
The collection's "path"
collectionRole
,
String
The name of the cache region
regionName
)

Implements org.hibernate.stat.spi.StatisticsImplementor.collectionCacheMiss.

Callback indicating a get from second level cache resulted in a miss.
public void
collectionCachePut(NavigableRole
The collection's "path"
collectionRole
,
String
The name of the cache region
regionName
)

Implements org.hibernate.stat.spi.StatisticsImplementor.collectionCachePut.

Callback indicating a put into second level cache.
private CacheRegionStatisticsImpl
computeQueryRegionStatistics(final String regionName)

Deprecated as a consequence of CacheRegionStatisticsImpl being deprecated.
public void
private CacheRegionStatisticsImpl
createCacheRegionStatistics(final String regionName)

Deprecated as a consequence of CacheRegionStatisticsImpl being deprecated.
public void
deleteEntity(String
The name of the entity deleted.
entityName
)

Implements org.hibernate.stat.spi.StatisticsImplementor.deleteEntity.

Callback about an entity being deleted.
public void
endTransaction(boolean
Was the transaction successful?
success
)

Implements org.hibernate.stat.spi.StatisticsImplementor.endTransaction.

Callback about a transaction completing.
public void
entityCacheHit(NavigableRole entityName, String regionName)

Implements org.hibernate.stat.spi.StatisticsImplementor.entityCacheHit.

Callback indicating a get from second level cache resulted in a hit.
public void
entityCacheMiss(NavigableRole entityName, String regionName)

Implements org.hibernate.stat.spi.StatisticsImplementor.entityCacheMiss.

Callback indicating a get from second level cache resulted in a miss.
public void
entityCachePut(NavigableRole entityName, String regionName)

Implements org.hibernate.stat.spi.StatisticsImplementor.entityCachePut.

Callback indicating a put into second level cache.
public void
fetchCollection(String
The collection role.
role
)

Implements org.hibernate.stat.spi.StatisticsImplementor.fetchCollection.

Callback to indicate a collection being fetched.
public void
fetchEntity(String
The name of the entity fetched.
entityName
)

Implements org.hibernate.stat.spi.StatisticsImplementor.fetchEntity.

Callback about an entity being fetched.
public void
flush()

Implements org.hibernate.stat.spi.StatisticsImplementor.flush.

Callback about a flush occurring
public CacheRegionStatisticsImpl
getCacheRegionStatistics(String
The unqualified region name
regionName
)

Implements org.hibernate.stat.Statistics.getCacheRegionStatistics.

Deprecated as a consequence of CacheRegionStatisticsImpl being deprecated.
Get statistics for either a domain-data or query-result region - this method checks both, preferring domain data region if one.
public long
getCloseStatementCount()

Implements org.hibernate.stat.Statistics.getCloseStatementCount.

The number of prepared statements that were released
public long
getCollectionFetchCount()

Implements org.hibernate.stat.Statistics.getCollectionFetchCount.

Global number of collections fetched
public long
getCollectionLoadCount()

Implements org.hibernate.stat.Statistics.getCollectionLoadCount.

Global number of collections loaded
public long
public long
getCollectionRemoveCount()

Implements org.hibernate.stat.Statistics.getCollectionRemoveCount.

Global number of collections removed
public String[]
getCollectionRoleNames()

Implements org.hibernate.stat.Statistics.getCollectionRoleNames.

Get the names of all collection roles
public CollectionStatisticsImpl
getCollectionStatistics(String
collection role
role
)

Implements org.hibernate.stat.Statistics.getCollectionStatistics.

Get collection statistics per role
public long
getCollectionUpdateCount()

Implements org.hibernate.stat.Statistics.getCollectionUpdateCount.

Global number of collections updated
public long
getConnectCount()

Implements org.hibernate.stat.Statistics.getConnectCount.

Get the global number of connections asked by the sessions (the actual number of connections used may be much smaller depending whether you use a connection pool or not)
public CacheRegionStatisticsImpl
getDomainDataRegionStatistics(String
The unqualified region name
regionName
)

Implements org.hibernate.stat.Statistics.getDomainDataRegionStatistics.

Deprecated as a consequence of CacheRegionStatisticsImpl being deprecated.
Second-level cache statistics per domain data (entity, collection, natural-id) region
public long
getEntityDeleteCount()

Implements org.hibernate.stat.Statistics.getEntityDeleteCount.

Get global number of entity deletes
public long
getEntityFetchCount()

Implements org.hibernate.stat.Statistics.getEntityFetchCount.

Get global number of entity fetches
public long
getEntityInsertCount()

Implements org.hibernate.stat.Statistics.getEntityInsertCount.

Get global number of entity inserts
public long
getEntityLoadCount()

Implements org.hibernate.stat.Statistics.getEntityLoadCount.

Get global number of entity loads
public String[]
getEntityNames()

Implements org.hibernate.stat.Statistics.getEntityNames.

Get the names of all entities
public EntityStatisticsImpl
getEntityStatistics(String
entity name
entityName
)

Implements org.hibernate.stat.Statistics.getEntityStatistics.

find entity statistics per name
public long
getEntityUpdateCount()

Implements org.hibernate.stat.Statistics.getEntityUpdateCount.

Get global number of entity updates
public long
getFlushCount()

Implements org.hibernate.stat.Statistics.getFlushCount.

Get the global number of flush operations executed (either manual or automatic).
public long
getNaturalIdCacheHitCount()

Implements org.hibernate.stat.Statistics.getNaturalIdCacheHitCount.

Get the global number of cached natural id lookups successfully retrieved from cache
public long
getNaturalIdCacheMissCount()

Implements org.hibernate.stat.Statistics.getNaturalIdCacheMissCount.

Get the global number of cached natural id lookups *not* found in cache
public long
getNaturalIdCachePutCount()

Implements org.hibernate.stat.Statistics.getNaturalIdCachePutCount.

Get the global number of cacheable natural id lookups put in cache
public DeprecatedNaturalIdCacheStatisticsImpl
getNaturalIdCacheStatistics(String
region name
regionName
)

Implements org.hibernate.stat.Statistics.getNaturalIdCacheStatistics.

Deprecated as a consequence of DeprecatedNaturalIdCacheStatisticsImpl being deprecated.
Natural id cache statistics per region
public long
getNaturalIdQueryExecutionCount()

Implements org.hibernate.stat.Statistics.getNaturalIdQueryExecutionCount.

Get the global number of natural id queries executed against the database
public long
getNaturalIdQueryExecutionMaxTime()

Implements org.hibernate.stat.Statistics.getNaturalIdQueryExecutionMaxTime.

Get the global maximum query time for natural id queries executed against the database
public String
public String
public NaturalIdStatisticsImpl
getNaturalIdStatistics(String
The entity name that is the root of the hierarchy containing the natural id
rootEntityName
)

Implements org.hibernate.stat.Statistics.getNaturalIdStatistics.

Natural id resolution query statistics for an entity type
public long
getOptimisticFailureCount()

Implements org.hibernate.stat.Statistics.getOptimisticFailureCount.

The number of Hibernate StaleObjectStateExceptions or JPA OptimisticLockExceptions that occurred.
public long
getPrepareStatementCount()

Implements org.hibernate.stat.Statistics.getPrepareStatementCount.

The number of prepared statements that were acquired
public String[]
getQueries()

Implements org.hibernate.stat.Statistics.getQueries.

Get all executed query strings.
public long
getQueryCacheHitCount()

Implements org.hibernate.stat.Statistics.getQueryCacheHitCount.

Get the global number of cached queries successfully retrieved from cache
public long
getQueryCacheMissCount()

Implements org.hibernate.stat.Statistics.getQueryCacheMissCount.

Get the global number of cached queries *not* found in cache
public long
getQueryCachePutCount()

Implements org.hibernate.stat.Statistics.getQueryCachePutCount.

Get the global number of cacheable queries put in cache
public long
getQueryExecutionCount()

Implements org.hibernate.stat.Statistics.getQueryExecutionCount.

Get global number of executed queries
public long
getQueryExecutionMaxTime()

Implements org.hibernate.stat.Statistics.getQueryExecutionMaxTime.

Get the time in milliseconds of the slowest query.
public String
public long
getQueryPlanCacheHitCount()

Overrides default org.hibernate.stat.Statistics.getQueryPlanCacheHitCount.

Get the global number of query plans successfully retrieved from cache
public long
getQueryPlanCacheMissCount()

Overrides default org.hibernate.stat.Statistics.getQueryPlanCacheMissCount.

Get the global number of query plans lookups *not* found in cache
public CacheRegionStatisticsImpl
getQueryRegionStatistics(final String
The unqualified region name
regionName
)

Implements org.hibernate.stat.Statistics.getQueryRegionStatistics.

Deprecated as a consequence of CacheRegionStatisticsImpl being deprecated.
Second-level cache statistics per query region
private CacheRegionStatisticsImpl
getQueryRegionStats(String regionName)

Deprecated as a consequence of CacheRegionStatisticsImpl being deprecated.
public QueryStatisticsImpl
getQueryStatistics(String
query string
queryString
)

Implements org.hibernate.stat.Statistics.getQueryStatistics.

Query statistics from query string (HQL or SQL)
public long
getSecondLevelCacheHitCount()

Implements org.hibernate.stat.Statistics.getSecondLevelCacheHitCount.

Global number of cacheable entities/collections successfully retrieved from the cache
public long
getSecondLevelCacheMissCount()

Implements org.hibernate.stat.Statistics.getSecondLevelCacheMissCount.

Global number of cacheable entities/collections not found in the cache and loaded from the database.
public long
getSecondLevelCachePutCount()

Implements org.hibernate.stat.Statistics.getSecondLevelCachePutCount.

Global number of cacheable entities/collections put in the cache
public String[]
public CacheRegionStatisticsImpl
getSecondLevelCacheStatistics(String
qualified region name
regionName
)

Implements org.hibernate.stat.Statistics.getSecondLevelCacheStatistics.

Deprecated as a consequence of CacheRegionStatisticsImpl being deprecated.
Second-level cache statistics per region
public long
getSessionCloseCount()

Implements org.hibernate.stat.Statistics.getSessionCloseCount.

Global number of sessions closed
public long
getSessionOpenCount()

Implements org.hibernate.stat.Statistics.getSessionOpenCount.

Global number of sessions opened
public long
getStartTime()

Implements org.hibernate.stat.Statistics.getStartTime.

The milliseconds (JVM standard System#currentTimeMillis()) since the initial creation of this Statistics instance or the last time clear() was called.
public long
getSuccessfulTransactionCount()

Implements org.hibernate.stat.Statistics.getSuccessfulTransactionCount.

The number of transactions we know to have been successful
public long
getTransactionCount()

Implements org.hibernate.stat.Statistics.getTransactionCount.

The number of transactions we know to have completed
public long
getUpdateTimestampsCacheHitCount()

Implements org.hibernate.stat.Statistics.getUpdateTimestampsCacheHitCount.

Get the global number of timestamps successfully retrieved from cache
public long
getUpdateTimestampsCacheMissCount()

Implements org.hibernate.stat.Statistics.getUpdateTimestampsCacheMissCount.

Get the global number of timestamp requests that were not found in the cache
public long
getUpdateTimestampsCachePutCount()

Implements org.hibernate.stat.Statistics.getUpdateTimestampsCachePutCount.

Get the global number of timestamps put in cache
public void
insertEntity(String
The name of the entity inserted
entityName
)

Implements org.hibernate.stat.spi.StatisticsImplementor.insertEntity.

Callback about an entity being inserted
private CacheRegionStatisticsImpl
instantiateCacheRegionStatistics(final String regionName)

Deprecated as a consequence of CacheRegionStatisticsImpl being deprecated.
private CacheRegionStatisticsImpl
instantiateCacheRegionStatsForQueryResults(final String regionName)

Deprecated as a consequence of CacheRegionStatisticsImpl being deprecated.
private CollectionStatisticsImpl
private DeprecatedNaturalIdCacheStatisticsImpl
instantiateDeprecatedNaturalIdCacheStatistics(final String unqualifiedRegionName)

Deprecated as a consequence of DeprecatedNaturalIdCacheStatisticsImpl being deprecated.
private EntityStatisticsImpl
private NaturalIdStatisticsImpl
public boolean
public void
loadCollection(String
The collection role.
role
)

Implements org.hibernate.stat.spi.StatisticsImplementor.loadCollection.

Callback about a collection loading.
public void
loadEntity(String
The name of the entity loaded.
entityName
)

Implements org.hibernate.stat.spi.StatisticsImplementor.loadEntity.

Callback about an entity being loaded.
public void
logSummary()

Implements org.hibernate.stat.Statistics.logSummary.

log in info level the main statistics
public void
naturalIdCacheHit(NavigableRole rootEntityName, String regionName)

Implements org.hibernate.stat.spi.StatisticsImplementor.naturalIdCacheHit.

Callback indicating a get from natural id cache resulted in a hit.
public void
naturalIdCacheMiss(NavigableRole rootEntityName, String regionName)

Implements org.hibernate.stat.spi.StatisticsImplementor.naturalIdCacheMiss.

Callback indicating a get from natural id cache resulted in a miss.
public void
naturalIdCachePut(NavigableRole rootEntityName, String regionName)

Implements org.hibernate.stat.spi.StatisticsImplementor.naturalIdCachePut.

Callback indicating a put into natural id cache.
public void
naturalIdQueryExecuted(String rootEntityName, long time)

Implements org.hibernate.stat.spi.StatisticsImplementor.naturalIdQueryExecuted.

Callback indicating execution of a natural id query
public void
openSession()

Implements org.hibernate.stat.spi.StatisticsImplementor.openSession.

Callback about a session being opened.
public void
optimisticFailure(String
The name of the entity.
entityName
)

Implements org.hibernate.stat.spi.StatisticsImplementor.optimisticFailure.

Callback about an optimistic lock failure on an entity
public void
prepareStatement()

Implements org.hibernate.stat.spi.StatisticsImplementor.prepareStatement.

Callback about a statement being prepared.
private String
qualify(final String regionName)

public void
queryCacheHit(String
The query
hql
,
String
The name of the cache region
regionName
)

Implements org.hibernate.stat.spi.StatisticsImplementor.queryCacheHit.

Callback indicating a get from the query cache resulted in a hit.
public void
queryCacheMiss(String
The query
hql
,
String
The name of the cache region
regionName
)

Implements org.hibernate.stat.spi.StatisticsImplementor.queryCacheMiss.

Callback indicating a get from the query cache resulted in a miss.
public void
queryCachePut(String
The query
hql
,
String
The cache region
regionName
)

Implements org.hibernate.stat.spi.StatisticsImplementor.queryCachePut.

Callback indicating a put into the query cache.
public void
queryCompiled(String
The query
hql
,
long
execution time
microseconds
)

Overrides default org.hibernate.stat.spi.StatisticsImplementor.queryCompiled.

Callback indicating compilation of a sql/hql query
public void
queryExecuted(String
The query
hql
,
int
Number of rows returned
rows
,
long
execution time
time
)

Implements org.hibernate.stat.spi.StatisticsImplementor.queryExecuted.

Callback indicating execution of a sql/hql query
public void
queryPlanCacheHit(String
The query
query
)

Overrides default org.hibernate.stat.spi.StatisticsImplementor.queryPlanCacheHit.

Callback indicating a get from the query plan cache resulted in a hit.
public void
queryPlanCacheMiss(String
The query
query
)

Overrides default org.hibernate.stat.spi.StatisticsImplementor.queryPlanCacheMiss.

Callback indicating a get from the query plan cache resulted in a miss.
public void
recreateCollection(String
The collection role.
role
)

Implements org.hibernate.stat.spi.StatisticsImplementor.recreateCollection.

Callback indicating a collection recreation (full deletion + full (re-)insertion).
public void
removeCollection(String
The collection role.
role
)

Implements org.hibernate.stat.spi.StatisticsImplementor.removeCollection.

Callback indicating a collection removal.
private void
public void
setStatisticsEnabled(boolean b)

Implements org.hibernate.stat.Statistics.setStatisticsEnabled.

Enable statistics logs (this is a dynamic parameter)
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
public void
updateCollection(String
The collection role.
role
)

Implements org.hibernate.stat.spi.StatisticsImplementor.updateCollection.

Callback indicating a collection was updated.
public void
updateEntity(String
The name of the entity updated.
entityName
)

Implements org.hibernate.stat.spi.StatisticsImplementor.updateEntity.

Callback about an entity being updated.
public void
updateTimestampsCacheHit()

Implements org.hibernate.stat.spi.StatisticsImplementor.updateTimestampsCacheHit.

Callback indicating a hit to the timestamp cache
public void
updateTimestampsCacheMiss()

Implements org.hibernate.stat.spi.StatisticsImplementor.updateTimestampsCacheMiss.

Callback indicating a miss to the timestamp cache
public void
updateTimestampsCachePut()

Implements org.hibernate.stat.spi.StatisticsImplementor.updateTimestampsCachePut.

Callback indicating a put to the timestamp cache
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait