Package org.hibernate.stat
Class ConcurrentStatisticsImpl
- java.lang.Object
-
- org.hibernate.stat.ConcurrentStatisticsImpl
-
- All Implemented Interfaces:
org.hibernate.stat.Statistics
,org.hibernate.stat.StatisticsImplementor
public class ConcurrentStatisticsImpl extends java.lang.Object implements org.hibernate.stat.Statistics, org.hibernate.stat.StatisticsImplementor
Implementation ofStatistics
, as well asStatisticsImplementor
, based on thejava.util.concurrent
package introduced in Java 5.
-
-
Constructor Summary
Constructors Constructor Description ConcurrentStatisticsImpl()
ConcurrentStatisticsImpl(org.hibernate.engine.SessionFactoryImplementor sessionFactory)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear()
reset all statisticsvoid
closeSession()
void
closeStatement()
void
connect()
void
deleteEntity(java.lang.String entityName)
void
endTransaction(boolean success)
void
fetchCollection(java.lang.String role)
void
fetchEntity(java.lang.String entityName)
void
flush()
long
getCloseStatementCount()
long
getCollectionFetchCount()
long
getCollectionLoadCount()
long
getCollectionRecreateCount()
long
getCollectionRemoveCount()
java.lang.String[]
getCollectionRoleNames()
Get the names of all collection rolesorg.hibernate.stat.CollectionStatistics
getCollectionStatistics(java.lang.String role)
Get collection statistics per rolelong
getCollectionUpdateCount()
long
getConnectCount()
long
getEntityDeleteCount()
long
getEntityFetchCount()
long
getEntityInsertCount()
long
getEntityLoadCount()
java.lang.String[]
getEntityNames()
Get the names of all entitiesorg.hibernate.stat.EntityStatistics
getEntityStatistics(java.lang.String entityName)
find entity statistics per namelong
getEntityUpdateCount()
long
getFlushCount()
long
getOptimisticFailureCount()
long
getPrepareStatementCount()
java.lang.String[]
getQueries()
Get all executed query stringslong
getQueryCacheHitCount()
long
getQueryCacheMissCount()
long
getQueryCachePutCount()
long
getQueryExecutionCount()
long
getQueryExecutionMaxTime()
java.lang.String
getQueryExecutionMaxTimeQueryString()
org.hibernate.stat.QueryStatistics
getQueryStatistics(java.lang.String queryString)
Query statistics from query string (HQL or SQL)long
getSecondLevelCacheHitCount()
long
getSecondLevelCacheMissCount()
long
getSecondLevelCachePutCount()
java.lang.String[]
getSecondLevelCacheRegionNames()
Get all second-level cache region namesorg.hibernate.stat.SecondLevelCacheStatistics
getSecondLevelCacheStatistics(java.lang.String regionName)
Second level cache statistics per regionlong
getSessionCloseCount()
long
getSessionOpenCount()
long
getStartTime()
long
getSuccessfulTransactionCount()
long
getTransactionCount()
void
insertEntity(java.lang.String entityName)
boolean
isStatisticsEnabled()
Are statistics loggedvoid
loadCollection(java.lang.String role)
void
loadEntity(java.lang.String entityName)
void
logSummary()
log in info level the main statisticsvoid
openSession()
void
optimisticFailure(java.lang.String entityName)
void
prepareStatement()
void
queryCacheHit(java.lang.String hql, java.lang.String regionName)
void
queryCacheMiss(java.lang.String hql, java.lang.String regionName)
void
queryCachePut(java.lang.String hql, java.lang.String regionName)
void
queryExecuted(java.lang.String hql, int rows, long time)
void
recreateCollection(java.lang.String role)
void
removeCollection(java.lang.String role)
void
secondLevelCacheHit(java.lang.String regionName)
void
secondLevelCacheMiss(java.lang.String regionName)
void
secondLevelCachePut(java.lang.String regionName)
void
setStatisticsEnabled(boolean b)
Enable statistics logs (this is a dynamic parameter)java.lang.String
toString()
void
updateCollection(java.lang.String role)
void
updateEntity(java.lang.String entityName)
-
-
-
Method Detail
-
clear
public void clear()
reset all statistics- Specified by:
clear
in interfaceorg.hibernate.stat.Statistics
-
openSession
public void openSession()
- Specified by:
openSession
in interfaceorg.hibernate.stat.StatisticsImplementor
-
closeSession
public void closeSession()
- Specified by:
closeSession
in interfaceorg.hibernate.stat.StatisticsImplementor
-
flush
public void flush()
- Specified by:
flush
in interfaceorg.hibernate.stat.StatisticsImplementor
-
connect
public void connect()
- Specified by:
connect
in interfaceorg.hibernate.stat.StatisticsImplementor
-
loadEntity
public void loadEntity(java.lang.String entityName)
- Specified by:
loadEntity
in interfaceorg.hibernate.stat.StatisticsImplementor
-
fetchEntity
public void fetchEntity(java.lang.String entityName)
- Specified by:
fetchEntity
in interfaceorg.hibernate.stat.StatisticsImplementor
-
getEntityStatistics
public org.hibernate.stat.EntityStatistics getEntityStatistics(java.lang.String entityName)
find entity statistics per name- Specified by:
getEntityStatistics
in interfaceorg.hibernate.stat.Statistics
- Parameters:
entityName
- entity name- Returns:
- EntityStatistics object
-
updateEntity
public void updateEntity(java.lang.String entityName)
- Specified by:
updateEntity
in interfaceorg.hibernate.stat.StatisticsImplementor
-
insertEntity
public void insertEntity(java.lang.String entityName)
- Specified by:
insertEntity
in interfaceorg.hibernate.stat.StatisticsImplementor
-
deleteEntity
public void deleteEntity(java.lang.String entityName)
- Specified by:
deleteEntity
in interfaceorg.hibernate.stat.StatisticsImplementor
-
getCollectionStatistics
public org.hibernate.stat.CollectionStatistics getCollectionStatistics(java.lang.String role)
Get collection statistics per role- Specified by:
getCollectionStatistics
in interfaceorg.hibernate.stat.Statistics
- Parameters:
role
- collection role- Returns:
- CollectionStatistics
-
loadCollection
public void loadCollection(java.lang.String role)
- Specified by:
loadCollection
in interfaceorg.hibernate.stat.StatisticsImplementor
-
fetchCollection
public void fetchCollection(java.lang.String role)
- Specified by:
fetchCollection
in interfaceorg.hibernate.stat.StatisticsImplementor
-
updateCollection
public void updateCollection(java.lang.String role)
- Specified by:
updateCollection
in interfaceorg.hibernate.stat.StatisticsImplementor
-
recreateCollection
public void recreateCollection(java.lang.String role)
- Specified by:
recreateCollection
in interfaceorg.hibernate.stat.StatisticsImplementor
-
removeCollection
public void removeCollection(java.lang.String role)
- Specified by:
removeCollection
in interfaceorg.hibernate.stat.StatisticsImplementor
-
getSecondLevelCacheStatistics
public org.hibernate.stat.SecondLevelCacheStatistics getSecondLevelCacheStatistics(java.lang.String regionName)
Second level cache statistics per region- Specified by:
getSecondLevelCacheStatistics
in interfaceorg.hibernate.stat.Statistics
- Parameters:
regionName
- region name- Returns:
- SecondLevelCacheStatistics
-
secondLevelCachePut
public void secondLevelCachePut(java.lang.String regionName)
- Specified by:
secondLevelCachePut
in interfaceorg.hibernate.stat.StatisticsImplementor
-
secondLevelCacheHit
public void secondLevelCacheHit(java.lang.String regionName)
- Specified by:
secondLevelCacheHit
in interfaceorg.hibernate.stat.StatisticsImplementor
-
secondLevelCacheMiss
public void secondLevelCacheMiss(java.lang.String regionName)
- Specified by:
secondLevelCacheMiss
in interfaceorg.hibernate.stat.StatisticsImplementor
-
queryExecuted
public void queryExecuted(java.lang.String hql, int rows, long time)
- Specified by:
queryExecuted
in interfaceorg.hibernate.stat.StatisticsImplementor
-
queryCacheHit
public void queryCacheHit(java.lang.String hql, java.lang.String regionName)
- Specified by:
queryCacheHit
in interfaceorg.hibernate.stat.StatisticsImplementor
-
queryCacheMiss
public void queryCacheMiss(java.lang.String hql, java.lang.String regionName)
- Specified by:
queryCacheMiss
in interfaceorg.hibernate.stat.StatisticsImplementor
-
queryCachePut
public void queryCachePut(java.lang.String hql, java.lang.String regionName)
- Specified by:
queryCachePut
in interfaceorg.hibernate.stat.StatisticsImplementor
-
getQueryStatistics
public org.hibernate.stat.QueryStatistics getQueryStatistics(java.lang.String queryString)
Query statistics from query string (HQL or SQL)- Specified by:
getQueryStatistics
in interfaceorg.hibernate.stat.Statistics
- Parameters:
queryString
- query string- Returns:
- QueryStatistics
-
getEntityDeleteCount
public long getEntityDeleteCount()
- Specified by:
getEntityDeleteCount
in interfaceorg.hibernate.stat.Statistics
- Returns:
- entity deletion count
-
getEntityInsertCount
public long getEntityInsertCount()
- Specified by:
getEntityInsertCount
in interfaceorg.hibernate.stat.Statistics
- Returns:
- entity insertion count
-
getEntityLoadCount
public long getEntityLoadCount()
- Specified by:
getEntityLoadCount
in interfaceorg.hibernate.stat.Statistics
- Returns:
- entity load (from DB)
-
getEntityFetchCount
public long getEntityFetchCount()
- Specified by:
getEntityFetchCount
in interfaceorg.hibernate.stat.Statistics
- Returns:
- entity fetch (from DB)
-
getEntityUpdateCount
public long getEntityUpdateCount()
- Specified by:
getEntityUpdateCount
in interfaceorg.hibernate.stat.Statistics
- Returns:
- entity update
-
getQueryExecutionCount
public long getQueryExecutionCount()
- Specified by:
getQueryExecutionCount
in interfaceorg.hibernate.stat.Statistics
-
getQueryCacheHitCount
public long getQueryCacheHitCount()
- Specified by:
getQueryCacheHitCount
in interfaceorg.hibernate.stat.Statistics
-
getQueryCacheMissCount
public long getQueryCacheMissCount()
- Specified by:
getQueryCacheMissCount
in interfaceorg.hibernate.stat.Statistics
-
getQueryCachePutCount
public long getQueryCachePutCount()
- Specified by:
getQueryCachePutCount
in interfaceorg.hibernate.stat.Statistics
-
getFlushCount
public long getFlushCount()
- Specified by:
getFlushCount
in interfaceorg.hibernate.stat.Statistics
- Returns:
- flush
-
getConnectCount
public long getConnectCount()
- Specified by:
getConnectCount
in interfaceorg.hibernate.stat.Statistics
- Returns:
- session connect
-
getSecondLevelCacheHitCount
public long getSecondLevelCacheHitCount()
- Specified by:
getSecondLevelCacheHitCount
in interfaceorg.hibernate.stat.Statistics
- Returns:
- second level cache hit
-
getSecondLevelCacheMissCount
public long getSecondLevelCacheMissCount()
- Specified by:
getSecondLevelCacheMissCount
in interfaceorg.hibernate.stat.Statistics
- Returns:
- second level cache miss
-
getSecondLevelCachePutCount
public long getSecondLevelCachePutCount()
- Specified by:
getSecondLevelCachePutCount
in interfaceorg.hibernate.stat.Statistics
- Returns:
- second level cache put
-
getSessionCloseCount
public long getSessionCloseCount()
- Specified by:
getSessionCloseCount
in interfaceorg.hibernate.stat.Statistics
- Returns:
- session closing
-
getSessionOpenCount
public long getSessionOpenCount()
- Specified by:
getSessionOpenCount
in interfaceorg.hibernate.stat.Statistics
- Returns:
- session opening
-
getCollectionLoadCount
public long getCollectionLoadCount()
- Specified by:
getCollectionLoadCount
in interfaceorg.hibernate.stat.Statistics
- Returns:
- collection loading (from DB)
-
getCollectionFetchCount
public long getCollectionFetchCount()
- Specified by:
getCollectionFetchCount
in interfaceorg.hibernate.stat.Statistics
- Returns:
- collection fetching (from DB)
-
getCollectionUpdateCount
public long getCollectionUpdateCount()
- Specified by:
getCollectionUpdateCount
in interfaceorg.hibernate.stat.Statistics
- Returns:
- collection update
-
getCollectionRemoveCount
public long getCollectionRemoveCount()
- Specified by:
getCollectionRemoveCount
in interfaceorg.hibernate.stat.Statistics
- Returns:
- collection removal FIXME: even if isInverse="true"?
-
getCollectionRecreateCount
public long getCollectionRecreateCount()
- Specified by:
getCollectionRecreateCount
in interfaceorg.hibernate.stat.Statistics
- Returns:
- collection recreation
-
getStartTime
public long getStartTime()
- Specified by:
getStartTime
in interfaceorg.hibernate.stat.Statistics
- Returns:
- start time in ms (JVM standards
System.currentTimeMillis()
)
-
logSummary
public void logSummary()
log in info level the main statistics- Specified by:
logSummary
in interfaceorg.hibernate.stat.Statistics
-
isStatisticsEnabled
public boolean isStatisticsEnabled()
Are statistics logged- Specified by:
isStatisticsEnabled
in interfaceorg.hibernate.stat.Statistics
-
setStatisticsEnabled
public void setStatisticsEnabled(boolean b)
Enable statistics logs (this is a dynamic parameter)- Specified by:
setStatisticsEnabled
in interfaceorg.hibernate.stat.Statistics
-
getQueryExecutionMaxTime
public long getQueryExecutionMaxTime()
- Specified by:
getQueryExecutionMaxTime
in interfaceorg.hibernate.stat.Statistics
- Returns:
- Returns the max query execution time, for all queries
-
getQueries
public java.lang.String[] getQueries()
Get all executed query strings- Specified by:
getQueries
in interfaceorg.hibernate.stat.Statistics
-
getEntityNames
public java.lang.String[] getEntityNames()
Get the names of all entities- Specified by:
getEntityNames
in interfaceorg.hibernate.stat.Statistics
-
getCollectionRoleNames
public java.lang.String[] getCollectionRoleNames()
Get the names of all collection roles- Specified by:
getCollectionRoleNames
in interfaceorg.hibernate.stat.Statistics
-
getSecondLevelCacheRegionNames
public java.lang.String[] getSecondLevelCacheRegionNames()
Get all second-level cache region names- Specified by:
getSecondLevelCacheRegionNames
in interfaceorg.hibernate.stat.Statistics
-
endTransaction
public void endTransaction(boolean success)
- Specified by:
endTransaction
in interfaceorg.hibernate.stat.StatisticsImplementor
-
getSuccessfulTransactionCount
public long getSuccessfulTransactionCount()
- Specified by:
getSuccessfulTransactionCount
in interfaceorg.hibernate.stat.Statistics
-
getTransactionCount
public long getTransactionCount()
- Specified by:
getTransactionCount
in interfaceorg.hibernate.stat.Statistics
-
closeStatement
public void closeStatement()
- Specified by:
closeStatement
in interfaceorg.hibernate.stat.StatisticsImplementor
-
prepareStatement
public void prepareStatement()
- Specified by:
prepareStatement
in interfaceorg.hibernate.stat.StatisticsImplementor
-
getCloseStatementCount
public long getCloseStatementCount()
- Specified by:
getCloseStatementCount
in interfaceorg.hibernate.stat.Statistics
-
getPrepareStatementCount
public long getPrepareStatementCount()
- Specified by:
getPrepareStatementCount
in interfaceorg.hibernate.stat.Statistics
-
optimisticFailure
public void optimisticFailure(java.lang.String entityName)
- Specified by:
optimisticFailure
in interfaceorg.hibernate.stat.StatisticsImplementor
-
getOptimisticFailureCount
public long getOptimisticFailureCount()
- Specified by:
getOptimisticFailureCount
in interfaceorg.hibernate.stat.Statistics
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
getQueryExecutionMaxTimeQueryString
public java.lang.String getQueryExecutionMaxTimeQueryString()
- Specified by:
getQueryExecutionMaxTimeQueryString
in interfaceorg.hibernate.stat.Statistics
-
-