org.hibernate.stat
Class ConcurrentStatisticsImpl

java.lang.Object
  extended by org.hibernate.stat.ConcurrentStatisticsImpl
All Implemented Interfaces:
org.hibernate.stat.Statistics, org.hibernate.stat.StatisticsImplementor

public class ConcurrentStatisticsImpl
extends Object
implements org.hibernate.stat.Statistics, org.hibernate.stat.StatisticsImplementor

Implementation of Statistics, as well as StatisticsImplementor, based on the java.util.concurrent package introduced in Java 5.

Author:
Alex Snaps

Constructor Summary
ConcurrentStatisticsImpl()
           
ConcurrentStatisticsImpl(org.hibernate.engine.SessionFactoryImplementor sessionFactory)
           
 
Method Summary
 void clear()
          reset all statistics
 void closeSession()
           
 void closeStatement()
           
 void connect()
           
 void deleteEntity(String entityName)
           
 void endTransaction(boolean success)
           
 void fetchCollection(String role)
           
 void fetchEntity(String entityName)
           
 void flush()
           
 long getCloseStatementCount()
           
 long getCollectionFetchCount()
           
 long getCollectionLoadCount()
           
 long getCollectionRecreateCount()
           
 long getCollectionRemoveCount()
           
 String[] getCollectionRoleNames()
          Get the names of all collection roles
 org.hibernate.stat.CollectionStatistics getCollectionStatistics(String role)
          Get collection statistics per role
 long getCollectionUpdateCount()
           
 long getConnectCount()
           
 long getEntityDeleteCount()
           
 long getEntityFetchCount()
           
 long getEntityInsertCount()
           
 long getEntityLoadCount()
           
 String[] getEntityNames()
          Get the names of all entities
 org.hibernate.stat.EntityStatistics getEntityStatistics(String entityName)
          find entity statistics per name
 long getEntityUpdateCount()
           
 long getFlushCount()
           
 long getOptimisticFailureCount()
           
 long getPrepareStatementCount()
           
 String[] getQueries()
          Get all executed query strings
 long getQueryCacheHitCount()
           
 long getQueryCacheMissCount()
           
 long getQueryCachePutCount()
           
 long getQueryExecutionCount()
           
 long getQueryExecutionMaxTime()
           
 String getQueryExecutionMaxTimeQueryString()
           
 org.hibernate.stat.QueryStatistics getQueryStatistics(String queryString)
          Query statistics from query string (HQL or SQL)
 long getSecondLevelCacheHitCount()
           
 long getSecondLevelCacheMissCount()
           
 long getSecondLevelCachePutCount()
           
 String[] getSecondLevelCacheRegionNames()
          Get all second-level cache region names
 org.hibernate.stat.SecondLevelCacheStatistics getSecondLevelCacheStatistics(String regionName)
          Second level cache statistics per region
 long getSessionCloseCount()
           
 long getSessionOpenCount()
           
 long getStartTime()
           
 long getSuccessfulTransactionCount()
           
 long getTransactionCount()
           
 void insertEntity(String entityName)
           
 boolean isStatisticsEnabled()
          Are statistics logged
 void loadCollection(String role)
           
 void loadEntity(String entityName)
           
 void logSummary()
          log in info level the main statistics
 void openSession()
           
 void optimisticFailure(String entityName)
           
 void prepareStatement()
           
 void queryCacheHit(String hql, String regionName)
           
 void queryCacheMiss(String hql, String regionName)
           
 void queryCachePut(String hql, String regionName)
           
 void queryExecuted(String hql, int rows, long time)
           
 void recreateCollection(String role)
           
 void removeCollection(String role)
           
 void secondLevelCacheHit(String regionName)
           
 void secondLevelCacheMiss(String regionName)
           
 void secondLevelCachePut(String regionName)
           
 void setStatisticsEnabled(boolean b)
          Enable statistics logs (this is a dynamic parameter)
 String toString()
           
 void updateCollection(String role)
           
 void updateEntity(String entityName)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ConcurrentStatisticsImpl

public ConcurrentStatisticsImpl()

ConcurrentStatisticsImpl

public ConcurrentStatisticsImpl(org.hibernate.engine.SessionFactoryImplementor sessionFactory)
Method Detail

clear

public void clear()
reset all statistics

Specified by:
clear in interface org.hibernate.stat.Statistics

openSession

public void openSession()
Specified by:
openSession in interface org.hibernate.stat.StatisticsImplementor

closeSession

public void closeSession()
Specified by:
closeSession in interface org.hibernate.stat.StatisticsImplementor

flush

public void flush()
Specified by:
flush in interface org.hibernate.stat.StatisticsImplementor

connect

public void connect()
Specified by:
connect in interface org.hibernate.stat.StatisticsImplementor

loadEntity

public void loadEntity(String entityName)
Specified by:
loadEntity in interface org.hibernate.stat.StatisticsImplementor

fetchEntity

public void fetchEntity(String entityName)
Specified by:
fetchEntity in interface org.hibernate.stat.StatisticsImplementor

getEntityStatistics

public org.hibernate.stat.EntityStatistics getEntityStatistics(String entityName)
find entity statistics per name

Specified by:
getEntityStatistics in interface org.hibernate.stat.Statistics
Parameters:
entityName - entity name
Returns:
EntityStatistics object

updateEntity

public void updateEntity(String entityName)
Specified by:
updateEntity in interface org.hibernate.stat.StatisticsImplementor

insertEntity

public void insertEntity(String entityName)
Specified by:
insertEntity in interface org.hibernate.stat.StatisticsImplementor

deleteEntity

public void deleteEntity(String entityName)
Specified by:
deleteEntity in interface org.hibernate.stat.StatisticsImplementor

getCollectionStatistics

public org.hibernate.stat.CollectionStatistics getCollectionStatistics(String role)
Get collection statistics per role

Specified by:
getCollectionStatistics in interface org.hibernate.stat.Statistics
Parameters:
role - collection role
Returns:
CollectionStatistics

loadCollection

public void loadCollection(String role)
Specified by:
loadCollection in interface org.hibernate.stat.StatisticsImplementor

fetchCollection

public void fetchCollection(String role)
Specified by:
fetchCollection in interface org.hibernate.stat.StatisticsImplementor

updateCollection

public void updateCollection(String role)
Specified by:
updateCollection in interface org.hibernate.stat.StatisticsImplementor

recreateCollection

public void recreateCollection(String role)
Specified by:
recreateCollection in interface org.hibernate.stat.StatisticsImplementor

removeCollection

public void removeCollection(String role)
Specified by:
removeCollection in interface org.hibernate.stat.StatisticsImplementor

getSecondLevelCacheStatistics

public org.hibernate.stat.SecondLevelCacheStatistics getSecondLevelCacheStatistics(String regionName)
Second level cache statistics per region

Specified by:
getSecondLevelCacheStatistics in interface org.hibernate.stat.Statistics
Parameters:
regionName - region name
Returns:
SecondLevelCacheStatistics

secondLevelCachePut

public void secondLevelCachePut(String regionName)
Specified by:
secondLevelCachePut in interface org.hibernate.stat.StatisticsImplementor

secondLevelCacheHit

public void secondLevelCacheHit(String regionName)
Specified by:
secondLevelCacheHit in interface org.hibernate.stat.StatisticsImplementor

secondLevelCacheMiss

public void secondLevelCacheMiss(String regionName)
Specified by:
secondLevelCacheMiss in interface org.hibernate.stat.StatisticsImplementor

queryExecuted

public void queryExecuted(String hql,
                          int rows,
                          long time)
Specified by:
queryExecuted in interface org.hibernate.stat.StatisticsImplementor

queryCacheHit

public void queryCacheHit(String hql,
                          String regionName)
Specified by:
queryCacheHit in interface org.hibernate.stat.StatisticsImplementor

queryCacheMiss

public void queryCacheMiss(String hql,
                           String regionName)
Specified by:
queryCacheMiss in interface org.hibernate.stat.StatisticsImplementor

queryCachePut

public void queryCachePut(String hql,
                          String regionName)
Specified by:
queryCachePut in interface org.hibernate.stat.StatisticsImplementor

getQueryStatistics

public org.hibernate.stat.QueryStatistics getQueryStatistics(String queryString)
Query statistics from query string (HQL or SQL)

Specified by:
getQueryStatistics in interface org.hibernate.stat.Statistics
Parameters:
queryString - query string
Returns:
QueryStatistics

getEntityDeleteCount

public long getEntityDeleteCount()
Specified by:
getEntityDeleteCount in interface org.hibernate.stat.Statistics
Returns:
entity deletion count

getEntityInsertCount

public long getEntityInsertCount()
Specified by:
getEntityInsertCount in interface org.hibernate.stat.Statistics
Returns:
entity insertion count

getEntityLoadCount

public long getEntityLoadCount()
Specified by:
getEntityLoadCount in interface org.hibernate.stat.Statistics
Returns:
entity load (from DB)

getEntityFetchCount

public long getEntityFetchCount()
Specified by:
getEntityFetchCount in interface org.hibernate.stat.Statistics
Returns:
entity fetch (from DB)

getEntityUpdateCount

public long getEntityUpdateCount()
Specified by:
getEntityUpdateCount in interface org.hibernate.stat.Statistics
Returns:
entity update

getQueryExecutionCount

public long getQueryExecutionCount()
Specified by:
getQueryExecutionCount in interface org.hibernate.stat.Statistics

getQueryCacheHitCount

public long getQueryCacheHitCount()
Specified by:
getQueryCacheHitCount in interface org.hibernate.stat.Statistics

getQueryCacheMissCount

public long getQueryCacheMissCount()
Specified by:
getQueryCacheMissCount in interface org.hibernate.stat.Statistics

getQueryCachePutCount

public long getQueryCachePutCount()
Specified by:
getQueryCachePutCount in interface org.hibernate.stat.Statistics

getFlushCount

public long getFlushCount()
Specified by:
getFlushCount in interface org.hibernate.stat.Statistics
Returns:
flush

getConnectCount

public long getConnectCount()
Specified by:
getConnectCount in interface org.hibernate.stat.Statistics
Returns:
session connect

getSecondLevelCacheHitCount

public long getSecondLevelCacheHitCount()
Specified by:
getSecondLevelCacheHitCount in interface org.hibernate.stat.Statistics
Returns:
second level cache hit

getSecondLevelCacheMissCount

public long getSecondLevelCacheMissCount()
Specified by:
getSecondLevelCacheMissCount in interface org.hibernate.stat.Statistics
Returns:
second level cache miss

getSecondLevelCachePutCount

public long getSecondLevelCachePutCount()
Specified by:
getSecondLevelCachePutCount in interface org.hibernate.stat.Statistics
Returns:
second level cache put

getSessionCloseCount

public long getSessionCloseCount()
Specified by:
getSessionCloseCount in interface org.hibernate.stat.Statistics
Returns:
session closing

getSessionOpenCount

public long getSessionOpenCount()
Specified by:
getSessionOpenCount in interface org.hibernate.stat.Statistics
Returns:
session opening

getCollectionLoadCount

public long getCollectionLoadCount()
Specified by:
getCollectionLoadCount in interface org.hibernate.stat.Statistics
Returns:
collection loading (from DB)

getCollectionFetchCount

public long getCollectionFetchCount()
Specified by:
getCollectionFetchCount in interface org.hibernate.stat.Statistics
Returns:
collection fetching (from DB)

getCollectionUpdateCount

public long getCollectionUpdateCount()
Specified by:
getCollectionUpdateCount in interface org.hibernate.stat.Statistics
Returns:
collection update

getCollectionRemoveCount

public long getCollectionRemoveCount()
Specified by:
getCollectionRemoveCount in interface org.hibernate.stat.Statistics
Returns:
collection removal FIXME: even if isInverse="true"?

getCollectionRecreateCount

public long getCollectionRecreateCount()
Specified by:
getCollectionRecreateCount in interface org.hibernate.stat.Statistics
Returns:
collection recreation

getStartTime

public long getStartTime()
Specified by:
getStartTime in interface org.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 interface org.hibernate.stat.Statistics

isStatisticsEnabled

public boolean isStatisticsEnabled()
Are statistics logged

Specified by:
isStatisticsEnabled in interface org.hibernate.stat.Statistics

setStatisticsEnabled

public void setStatisticsEnabled(boolean b)
Enable statistics logs (this is a dynamic parameter)

Specified by:
setStatisticsEnabled in interface org.hibernate.stat.Statistics

getQueryExecutionMaxTime

public long getQueryExecutionMaxTime()
Specified by:
getQueryExecutionMaxTime in interface org.hibernate.stat.Statistics
Returns:
Returns the max query execution time, for all queries

getQueries

public String[] getQueries()
Get all executed query strings

Specified by:
getQueries in interface org.hibernate.stat.Statistics

getEntityNames

public String[] getEntityNames()
Get the names of all entities

Specified by:
getEntityNames in interface org.hibernate.stat.Statistics

getCollectionRoleNames

public String[] getCollectionRoleNames()
Get the names of all collection roles

Specified by:
getCollectionRoleNames in interface org.hibernate.stat.Statistics

getSecondLevelCacheRegionNames

public String[] getSecondLevelCacheRegionNames()
Get all second-level cache region names

Specified by:
getSecondLevelCacheRegionNames in interface org.hibernate.stat.Statistics

endTransaction

public void endTransaction(boolean success)
Specified by:
endTransaction in interface org.hibernate.stat.StatisticsImplementor

getSuccessfulTransactionCount

public long getSuccessfulTransactionCount()
Specified by:
getSuccessfulTransactionCount in interface org.hibernate.stat.Statistics

getTransactionCount

public long getTransactionCount()
Specified by:
getTransactionCount in interface org.hibernate.stat.Statistics

closeStatement

public void closeStatement()
Specified by:
closeStatement in interface org.hibernate.stat.StatisticsImplementor

prepareStatement

public void prepareStatement()
Specified by:
prepareStatement in interface org.hibernate.stat.StatisticsImplementor

getCloseStatementCount

public long getCloseStatementCount()
Specified by:
getCloseStatementCount in interface org.hibernate.stat.Statistics

getPrepareStatementCount

public long getPrepareStatementCount()
Specified by:
getPrepareStatementCount in interface org.hibernate.stat.Statistics

optimisticFailure

public void optimisticFailure(String entityName)
Specified by:
optimisticFailure in interface org.hibernate.stat.StatisticsImplementor

getOptimisticFailureCount

public long getOptimisticFailureCount()
Specified by:
getOptimisticFailureCount in interface org.hibernate.stat.Statistics

toString

public String toString()
Overrides:
toString in class Object

getQueryExecutionMaxTimeQueryString

public String getQueryExecutionMaxTimeQueryString()
Specified by:
getQueryExecutionMaxTimeQueryString in interface org.hibernate.stat.Statistics


OmeroJava Api

Version: 4.3.3-00d1137e-b2894

Copyright © 2009 The University of Dundee. All Rights Reserved.