public class

ConcurrentStatisticsImpl

extends Object
implements Statistics StatisticsImplementor
java.lang.Object
   ↳ org.hibernate.stat.ConcurrentStatisticsImpl

Class Overview

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

Summary

Public Constructors
ConcurrentStatisticsImpl()
ConcurrentStatisticsImpl(SessionFactoryImplementor sessionFactory)
Public Methods
void clear()
reset all statistics
void closeSession()
Callback about a session being closed.
void closeStatement()
Callback about a statement being closed.
void connect()
Callback about a connection being obtained from ConnectionProvider
void deleteEntity(String entityName)
Callback about an entity being deleted.
void endTransaction(boolean success)
Callback about a transaction completing.
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
long getCloseStatementCount()
The number of prepared statements that were released
long getCollectionFetchCount()
Global number of collections fetched
long getCollectionLoadCount()
Global number of collections loaded
long getCollectionRecreateCount()
Global number of collections recreated
long getCollectionRemoveCount()
Global number of collections removed
String[] getCollectionRoleNames()
Get the names of all collection roles
CollectionStatistics getCollectionStatistics(String role)
Get collection statistics per role
long getCollectionUpdateCount()
Global number of collections updated
long 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)
long getEntityDeleteCount()
Get global number of entity deletes
long getEntityFetchCount()
Get global number of entity fetchs
long getEntityInsertCount()
Get global number of entity inserts
long getEntityLoadCount()
Get global number of entity loads
String[] getEntityNames()
Get the names of all entities
EntityStatistics getEntityStatistics(String entityName)
find entity statistics per name
long getEntityUpdateCount()
Get global number of entity updates
long getFlushCount()
Get the global number of flush executed by sessions (either implicit or explicit)
long getOptimisticFailureCount()
The number of StaleObjectStateExceptions that occurred
long getPrepareStatementCount()
The number of prepared statements that were acquired
String[] getQueries()
Get all executed query strings
long getQueryCacheHitCount()
Get the global number of cached queries successfully retrieved from cache
long getQueryCacheMissCount()
Get the global number of cached queries *not* found in cache
long getQueryCachePutCount()
Get the global number of cacheable queries put in cache
long getQueryExecutionCount()
Get global number of executed queries
long getQueryExecutionMaxTime()
Get the time in milliseconds of the slowest query.
String getQueryExecutionMaxTimeQueryString()
Get the query string for the slowest query.
QueryStatistics getQueryStatistics(String queryString)
Query statistics from query string (HQL or SQL)
long getSecondLevelCacheHitCount()
Global number of cacheable entities/collections successfully retrieved from the cache
long getSecondLevelCacheMissCount()
Global number of cacheable entities/collections not found in the cache and loaded from the database.
long getSecondLevelCachePutCount()
Global number of cacheable entities/collections put in the cache
String[] getSecondLevelCacheRegionNames()
Get all second-level cache region names
SecondLevelCacheStatistics getSecondLevelCacheStatistics(String regionName)
Second level cache statistics per region
long getSessionCloseCount()
Global number of sessions closed
long getSessionOpenCount()
Global number of sessions opened
long getStartTime()
long getSuccessfulTransactionCount()
The number of transactions we know to have been successful
long getTransactionCount()
The number of transactions we know to have completed
void insertEntity(String entityName)
Callback about an entity being inserted
boolean isStatisticsEnabled()
Are statistics logged
void loadCollection(String role)
Callback about a collection loading.
void loadEntity(String entityName)
Callback about an entity being loaded.
void logSummary()
log in info level the main statistics
void openSession()
Callback about a session being opened.
void optimisticFailure(String entityName)
Callback about an optimistic lock failure on an entity
void 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 queryExecuted(String hql, int rows, long time)
Callback indicating execution of a sql/hql query
void recreateCollection(String role)
Callback indicating a collection recreation (full deletion + full (re-)insertion).
void removeCollection(String role)
Callback indicating a collection removal.
void secondLevelCacheHit(String regionName)
Callback indicating a get from second level cache resulted in a hit.
void secondLevelCacheMiss(String regionName)
Callback indicating a get from second level cache resulted in a miss.
void secondLevelCachePut(String regionName)
Callback indicating a put into second level cache.
void setStatisticsEnabled(boolean b)
Enable statistics logs (this is a dynamic parameter)
String toString()
void updateCollection(String role)
Callback indicating a collection was updated.
void updateEntity(String entityName)
Callback about an entity being updated.
[Expand]
Inherited Methods
From class java.lang.Object
From interface org.hibernate.stat.Statistics
From interface org.hibernate.stat.StatisticsImplementor

Public Constructors

public ConcurrentStatisticsImpl ()

public ConcurrentStatisticsImpl (SessionFactoryImplementor sessionFactory)

Public Methods

public void clear ()

reset all statistics

public void closeSession ()

Callback about a session being closed.

public void closeStatement ()

Callback about a statement being closed.

public void connect ()

Callback about a connection being obtained from ConnectionProvider

public void deleteEntity (String entityName)

Callback about an entity being deleted.

Parameters
entityName The name of the entity deleted.

public void endTransaction (boolean success)

Callback about a transaction completing.

Parameters
success Was the transaction successful?

public void fetchCollection (String role)

Callback to indicate a collection being fetched. Unlike loadCollection(String), this indicates a separate query was needed.

Parameters
role The collection role.

public void fetchEntity (String entityName)

Callback about an entity being fetched. Unlike loadEntity(String) this indicates a separate query being performed.

Parameters
entityName The name of the entity fetched.

public void flush ()

Callback about a flush occurring

public long getCloseStatementCount ()

The number of prepared statements that were released

public long getCollectionFetchCount ()

Global number of collections fetched

Returns
  • collection fetching (from DB)

public long getCollectionLoadCount ()

Global number of collections loaded

Returns
  • collection loading (from DB)

public long getCollectionRecreateCount ()

Global number of collections recreated

Returns
  • collection recreation

public long getCollectionRemoveCount ()

Global number of collections removed

Returns
  • collection removal FIXME: even if isInverse="true"?

public String[] getCollectionRoleNames ()

Get the names of all collection roles

public CollectionStatistics getCollectionStatistics (String role)

Get collection statistics per role

Parameters
role collection role
Returns
  • CollectionStatistics

public long getCollectionUpdateCount ()

Global number of collections updated

Returns
  • collection update

public long 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)

Returns
  • session connect

public long getEntityDeleteCount ()

Get global number of entity deletes

Returns
  • entity deletion count

public long getEntityFetchCount ()

Get global number of entity fetchs

Returns
  • entity fetch (from DB)

public long getEntityInsertCount ()

Get global number of entity inserts

Returns
  • entity insertion count

public long getEntityLoadCount ()

Get global number of entity loads

Returns
  • entity load (from DB)

public String[] getEntityNames ()

Get the names of all entities

public EntityStatistics getEntityStatistics (String entityName)

find entity statistics per name

Parameters
entityName entity name
Returns
  • EntityStatistics object

public long getEntityUpdateCount ()

Get global number of entity updates

Returns
  • entity update

public long getFlushCount ()

Get the global number of flush executed by sessions (either implicit or explicit)

Returns
  • flush

public long getOptimisticFailureCount ()

The number of StaleObjectStateExceptions that occurred

public long getPrepareStatementCount ()

The number of prepared statements that were acquired

public String[] getQueries ()

Get all executed query strings

public long getQueryCacheHitCount ()

Get the global number of cached queries successfully retrieved from cache

public long getQueryCacheMissCount ()

Get the global number of cached queries *not* found in cache

public long getQueryCachePutCount ()

Get the global number of cacheable queries put in cache

public long getQueryExecutionCount ()

Get global number of executed queries

Returns
  • query execution count

public long getQueryExecutionMaxTime ()

Get the time in milliseconds of the slowest query.

Returns
  • Returns the max query execution time, for all queries

public String getQueryExecutionMaxTimeQueryString ()

Get the query string for the slowest query.

public QueryStatistics getQueryStatistics (String queryString)

Query statistics from query string (HQL or SQL)

Parameters
queryString query string
Returns
  • QueryStatistics

public long getSecondLevelCacheHitCount ()

Global number of cacheable entities/collections successfully retrieved from the cache

Returns
  • second level cache hit

public long getSecondLevelCacheMissCount ()

Global number of cacheable entities/collections not found in the cache and loaded from the database.

Returns
  • second level cache miss

public long getSecondLevelCachePutCount ()

Global number of cacheable entities/collections put in the cache

Returns
  • second level cache put

public String[] getSecondLevelCacheRegionNames ()

Get all second-level cache region names

public SecondLevelCacheStatistics getSecondLevelCacheStatistics (String regionName)

Second level cache statistics per region

Parameters
regionName region name
Returns
  • SecondLevelCacheStatistics

public long getSessionCloseCount ()

Global number of sessions closed

Returns
  • session closing

public long getSessionOpenCount ()

Global number of sessions opened

Returns
  • session opening

public long getStartTime ()

Returns

public long getSuccessfulTransactionCount ()

The number of transactions we know to have been successful

public long getTransactionCount ()

The number of transactions we know to have completed

public void insertEntity (String entityName)

Callback about an entity being inserted

Parameters
entityName The name of the entity inserted

public boolean isStatisticsEnabled ()

Are statistics logged

public void loadCollection (String role)

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.

Parameters
role The collection role.

public void loadEntity (String entityName)

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.

Parameters
entityName The name of the entity loaded.

public void logSummary ()

log in info level the main statistics

public void openSession ()

Callback about a session being opened.

public void optimisticFailure (String entityName)

Callback about an optimistic lock failure on an entity

Parameters
entityName The name of the entity.

public void prepareStatement ()

Callback about a statement being prepared.

public void queryCacheHit (String hql, String regionName)

Callback indicating a get from the query cache resulted in a hit.

Parameters
hql The query
regionName The name of the cache region

public void queryCacheMiss (String hql, String regionName)

Callback indicating a get from the query cache resulted in a miss.

Parameters
hql The query
regionName The name of the cache region

public void queryCachePut (String hql, String regionName)

Callback indicating a put into the query cache.

Parameters
hql The query
regionName The cache region

public void queryExecuted (String hql, int rows, long time)

Callback indicating execution of a sql/hql query

Parameters
hql The query
rows Number of rows returned
time execution time

public void recreateCollection (String role)

Callback indicating a collection recreation (full deletion + full (re-)insertion).

Parameters
role The collection role.

public void removeCollection (String role)

Callback indicating a collection removal.

Parameters
role The collection role.

public void secondLevelCacheHit (String regionName)

Callback indicating a get from second level cache resulted in a hit.

Parameters
regionName The name of the cache region

public void secondLevelCacheMiss (String regionName)

Callback indicating a get from second level cache resulted in a miss.

Parameters
regionName The name of the cache region

public void secondLevelCachePut (String regionName)

Callback indicating a put into second level cache.

Parameters
regionName The name of the cache region

public void setStatisticsEnabled (boolean b)

Enable statistics logs (this is a dynamic parameter)

public String toString ()

public void updateCollection (String role)

Callback indicating a collection was updated.

Parameters
role The collection role.

public void updateEntity (String entityName)

Callback about an entity being updated.

Parameters
entityName The name of the entity updated.