Class 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 of Statistics, as well as StatisticsImplementor, based on the java.util.concurrent package introduced in Java 5.
    • 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​(java.lang.String entityName)
        Specified by:
        loadEntity in interface org.hibernate.stat.StatisticsImplementor
      • fetchEntity

        public void fetchEntity​(java.lang.String entityName)
        Specified by:
        fetchEntity in interface org.hibernate.stat.StatisticsImplementor
      • getEntityStatistics

        public org.hibernate.stat.EntityStatistics getEntityStatistics​(java.lang.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​(java.lang.String entityName)
        Specified by:
        updateEntity in interface org.hibernate.stat.StatisticsImplementor
      • insertEntity

        public void insertEntity​(java.lang.String entityName)
        Specified by:
        insertEntity in interface org.hibernate.stat.StatisticsImplementor
      • deleteEntity

        public void deleteEntity​(java.lang.String entityName)
        Specified by:
        deleteEntity in interface org.hibernate.stat.StatisticsImplementor
      • getCollectionStatistics

        public org.hibernate.stat.CollectionStatistics getCollectionStatistics​(java.lang.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​(java.lang.String role)
        Specified by:
        loadCollection in interface org.hibernate.stat.StatisticsImplementor
      • fetchCollection

        public void fetchCollection​(java.lang.String role)
        Specified by:
        fetchCollection in interface org.hibernate.stat.StatisticsImplementor
      • updateCollection

        public void updateCollection​(java.lang.String role)
        Specified by:
        updateCollection in interface org.hibernate.stat.StatisticsImplementor
      • recreateCollection

        public void recreateCollection​(java.lang.String role)
        Specified by:
        recreateCollection in interface org.hibernate.stat.StatisticsImplementor
      • removeCollection

        public void removeCollection​(java.lang.String role)
        Specified by:
        removeCollection in interface org.hibernate.stat.StatisticsImplementor
      • getSecondLevelCacheStatistics

        public org.hibernate.stat.SecondLevelCacheStatistics getSecondLevelCacheStatistics​(java.lang.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​(java.lang.String regionName)
        Specified by:
        secondLevelCachePut in interface org.hibernate.stat.StatisticsImplementor
      • secondLevelCacheHit

        public void secondLevelCacheHit​(java.lang.String regionName)
        Specified by:
        secondLevelCacheHit in interface org.hibernate.stat.StatisticsImplementor
      • secondLevelCacheMiss

        public void secondLevelCacheMiss​(java.lang.String regionName)
        Specified by:
        secondLevelCacheMiss in interface org.hibernate.stat.StatisticsImplementor
      • queryExecuted

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

        public void queryCacheHit​(java.lang.String hql,
                                  java.lang.String regionName)
        Specified by:
        queryCacheHit in interface org.hibernate.stat.StatisticsImplementor
      • queryCacheMiss

        public void queryCacheMiss​(java.lang.String hql,
                                   java.lang.String regionName)
        Specified by:
        queryCacheMiss in interface org.hibernate.stat.StatisticsImplementor
      • queryCachePut

        public void queryCachePut​(java.lang.String hql,
                                  java.lang.String regionName)
        Specified by:
        queryCachePut in interface org.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 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 java.lang.String[] getQueries()
        Get all executed query strings
        Specified by:
        getQueries in interface org.hibernate.stat.Statistics
      • getEntityNames

        public java.lang.String[] getEntityNames()
        Get the names of all entities
        Specified by:
        getEntityNames in interface org.hibernate.stat.Statistics
      • getCollectionRoleNames

        public java.lang.String[] getCollectionRoleNames()
        Get the names of all collection roles
        Specified by:
        getCollectionRoleNames in interface org.hibernate.stat.Statistics
      • getSecondLevelCacheRegionNames

        public java.lang.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​(java.lang.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 java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • getQueryExecutionMaxTimeQueryString

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