org.hibernate.jmx
Class StatisticsService

java.lang.Object
  extended by org.hibernate.jmx.StatisticsService
All Implemented Interfaces:
StatisticsServiceMBean, Statistics

Deprecated. See HHH-6190 for details

@Deprecated
public class StatisticsService
extends Object
implements StatisticsServiceMBean

JMX service for Hibernate statistics

Register this MBean in your JMX server for a specific session factory

 //build the ObjectName you want
 Hashtable tb = new Hashtable();
 tb.put("type", "statistics");
 tb.put("sessionFactory", "myFinancialApp");
 ObjectName on = new ObjectName("hibernate", tb);
 StatisticsService stats = new StatisticsService();
 stats.setSessionFactory(sessionFactory);
 server.registerMBean(stats, on);
 
And call the MBean the way you want

Register this MBean in your JMX server with no specific session factory
 //build the ObjectName you want
 Hashtable tb = new Hashtable();
 tb.put("type", "statistics");
 tb.put("sessionFactory", "myFinancialApp");
 ObjectName on = new ObjectName("hibernate", tb);
 StatisticsService stats = new StatisticsService();
 server.registerMBean(stats, on);
 
And call the MBean by providing the SessionFactoryJNDIName first. Then the session factory will be retrieved from JNDI and the statistics loaded.


Constructor Summary
StatisticsService()
          Deprecated.  
 
Method Summary
 void clear()
          Deprecated. reset all statistics
 long getCloseStatementCount()
          Deprecated. The number of prepared statements that were released
 long getCollectionFetchCount()
          Deprecated. Global number of collections fetched
 long getCollectionLoadCount()
          Deprecated. Global number of collections loaded
 long getCollectionRecreateCount()
          Deprecated. Global number of collections recreated
 long getCollectionRemoveCount()
          Deprecated. Global number of collections removed
 String[] getCollectionRoleNames()
          Deprecated. Get the names of all collection roles
 CollectionStatistics getCollectionStatistics(String role)
          Deprecated. Get collection statistics per role
 long getCollectionUpdateCount()
          Deprecated. Global number of collections updated
 long getConnectCount()
          Deprecated. 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()
          Deprecated. Get global number of entity deletes
 long getEntityFetchCount()
          Deprecated. Get global number of entity fetchs
 long getEntityInsertCount()
          Deprecated. Get global number of entity inserts
 long getEntityLoadCount()
          Deprecated. Get global number of entity loads
 String[] getEntityNames()
          Deprecated. Get the names of all entities
 EntityStatistics getEntityStatistics(String entityName)
          Deprecated. find entity statistics per name
 long getEntityUpdateCount()
          Deprecated. Get global number of entity updates
 long getFlushCount()
          Deprecated. Get the global number of flush executed by sessions (either implicit or explicit)
 long getNaturalIdCacheHitCount()
          Deprecated. Get the global number of cached naturalId lookups successfully retrieved from cache
 long getNaturalIdCacheMissCount()
          Deprecated. Get the global number of cached naturalId lookups *not* found in cache
 long getNaturalIdCachePutCount()
          Deprecated. Get the global number of cacheable naturalId lookups put in cache
 NaturalIdCacheStatistics getNaturalIdCacheStatistics(String regionName)
          Deprecated. Natural id cache statistics per region
 long getNaturalIdQueryExecutionCount()
          Deprecated. Get the global number of naturalId queries executed against the database
 long getNaturalIdQueryExecutionMaxTime()
          Deprecated. Get the global maximum query time for naturalId queries executed against the database
 String getNaturalIdQueryExecutionMaxTimeRegion()
          Deprecated. Get the region for the maximum naturalId query time
 long getOptimisticFailureCount()
          Deprecated. The number of StaleObjectStateExceptions that occurred
 long getPrepareStatementCount()
          Deprecated. The number of prepared statements that were acquired
 String[] getQueries()
          Deprecated. Get all executed query strings
 long getQueryCacheHitCount()
          Deprecated. Get the global number of cached queries successfully retrieved from cache
 long getQueryCacheMissCount()
          Deprecated. Get the global number of cached queries *not* found in cache
 long getQueryCachePutCount()
          Deprecated. Get the global number of cacheable queries put in cache
 long getQueryExecutionCount()
          Deprecated. Get global number of executed queries
 long getQueryExecutionMaxTime()
          Deprecated. Get the time in milliseconds of the slowest query.
 String getQueryExecutionMaxTimeQueryString()
          Deprecated. Get the query string for the slowest query.
 QueryStatistics getQueryStatistics(String hql)
          Deprecated. Query statistics from query string (HQL or SQL)
 long getSecondLevelCacheHitCount()
          Deprecated. Global number of cacheable entities/collections successfully retrieved from the cache
 long getSecondLevelCacheMissCount()
          Deprecated. Global number of cacheable entities/collections not found in the cache and loaded from the database.
 long getSecondLevelCachePutCount()
          Deprecated. Global number of cacheable entities/collections put in the cache
 String[] getSecondLevelCacheRegionNames()
          Deprecated. Get all second-level cache region names
 SecondLevelCacheStatistics getSecondLevelCacheStatistics(String regionName)
          Deprecated. Second level cache statistics per region
 long getSessionCloseCount()
          Deprecated. Global number of sessions closed
 long getSessionOpenCount()
          Deprecated. Global number of sessions opened
 long getStartTime()
          Deprecated.  
 long getSuccessfulTransactionCount()
          Deprecated. The number of transactions we know to have been successful
 long getTransactionCount()
          Deprecated. The number of transactions we know to have completed
 long getUpdateTimestampsCacheHitCount()
          Deprecated. Get the global number of timestamps successfully retrieved from cache
 long getUpdateTimestampsCacheMissCount()
          Deprecated. Get the global number of tables for which no update timestamps was *not* found in cache
 long getUpdateTimestampsCachePutCount()
          Deprecated. Get the global number of timestamps put in cache
 boolean isStatisticsEnabled()
          Deprecated. Are statistics logged
 void logSummary()
          Deprecated. log in info level the main statistics
 void setSessionFactory(SessionFactory sf)
          Deprecated. Useful to init this MBean wo a JNDI session factory name
 void setSessionFactoryJNDIName(String sfJNDIName)
          Deprecated. Publish the statistics of a session factory bound to the default JNDI context
 void setStatisticsEnabled(boolean enable)
          Deprecated. Enable statistics logs (this is a dynamic parameter)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StatisticsService

public StatisticsService()
Deprecated. 
Method Detail

setSessionFactoryJNDIName

public void setSessionFactoryJNDIName(String sfJNDIName)
Deprecated. 
Description copied from interface: StatisticsServiceMBean
Publish the statistics of a session factory bound to the default JNDI context

Specified by:
setSessionFactoryJNDIName in interface StatisticsServiceMBean
Parameters:
sfJNDIName - session factory jndi name
See Also:
StatisticsServiceMBean.setSessionFactoryJNDIName(java.lang.String)

setSessionFactory

public void setSessionFactory(SessionFactory sf)
Deprecated. 
Useful to init this MBean wo a JNDI session factory name

Parameters:
sf - session factory to register

clear

public void clear()
Deprecated. 
Description copied from interface: Statistics
reset all statistics

Specified by:
clear in interface Statistics
See Also:
Statistics.clear()

getEntityStatistics

public EntityStatistics getEntityStatistics(String entityName)
Deprecated. 
Description copied from interface: Statistics
find entity statistics per name

Specified by:
getEntityStatistics in interface Statistics
Parameters:
entityName - entity name
Returns:
EntityStatistics object
See Also:
Statistics.getEntityStatistics(java.lang.String)

getCollectionStatistics

public CollectionStatistics getCollectionStatistics(String role)
Deprecated. 
Description copied from interface: Statistics
Get collection statistics per role

Specified by:
getCollectionStatistics in interface Statistics
Parameters:
role - collection role
Returns:
CollectionStatistics
See Also:
Statistics.getCollectionStatistics(java.lang.String)

getSecondLevelCacheStatistics

public SecondLevelCacheStatistics getSecondLevelCacheStatistics(String regionName)
Deprecated. 
Description copied from interface: Statistics
Second level cache statistics per region

Specified by:
getSecondLevelCacheStatistics in interface Statistics
Parameters:
regionName - region name
Returns:
SecondLevelCacheStatistics
See Also:
Statistics.getSecondLevelCacheStatistics(java.lang.String)

getQueryStatistics

public QueryStatistics getQueryStatistics(String hql)
Deprecated. 
Description copied from interface: Statistics
Query statistics from query string (HQL or SQL)

Specified by:
getQueryStatistics in interface Statistics
Parameters:
hql - query string
Returns:
QueryStatistics
See Also:
Statistics.getQueryStatistics(java.lang.String)

getEntityDeleteCount

public long getEntityDeleteCount()
Deprecated. 
Description copied from interface: Statistics
Get global number of entity deletes

Specified by:
getEntityDeleteCount in interface Statistics
Returns:
entity deletion count
See Also:
Statistics.getEntityDeleteCount()

getEntityInsertCount

public long getEntityInsertCount()
Deprecated. 
Description copied from interface: Statistics
Get global number of entity inserts

Specified by:
getEntityInsertCount in interface Statistics
Returns:
entity insertion count
See Also:
Statistics.getEntityInsertCount()

getEntityLoadCount

public long getEntityLoadCount()
Deprecated. 
Description copied from interface: Statistics
Get global number of entity loads

Specified by:
getEntityLoadCount in interface Statistics
Returns:
entity load (from DB)
See Also:
Statistics.getEntityLoadCount()

getEntityFetchCount

public long getEntityFetchCount()
Deprecated. 
Description copied from interface: Statistics
Get global number of entity fetchs

Specified by:
getEntityFetchCount in interface Statistics
Returns:
entity fetch (from DB)
See Also:
Statistics.getEntityFetchCount()

getEntityUpdateCount

public long getEntityUpdateCount()
Deprecated. 
Description copied from interface: Statistics
Get global number of entity updates

Specified by:
getEntityUpdateCount in interface Statistics
Returns:
entity update
See Also:
Statistics.getEntityUpdateCount()

getQueryExecutionCount

public long getQueryExecutionCount()
Deprecated. 
Description copied from interface: Statistics
Get global number of executed queries

Specified by:
getQueryExecutionCount in interface Statistics
Returns:
query execution count
See Also:
Statistics.getQueryExecutionCount()

getQueryCacheHitCount

public long getQueryCacheHitCount()
Deprecated. 
Description copied from interface: Statistics
Get the global number of cached queries successfully retrieved from cache

Specified by:
getQueryCacheHitCount in interface Statistics

getQueryExecutionMaxTime

public long getQueryExecutionMaxTime()
Deprecated. 
Description copied from interface: Statistics
Get the time in milliseconds of the slowest query.

Specified by:
getQueryExecutionMaxTime in interface Statistics

getQueryCacheMissCount

public long getQueryCacheMissCount()
Deprecated. 
Description copied from interface: Statistics
Get the global number of cached queries *not* found in cache

Specified by:
getQueryCacheMissCount in interface Statistics

getQueryCachePutCount

public long getQueryCachePutCount()
Deprecated. 
Description copied from interface: Statistics
Get the global number of cacheable queries put in cache

Specified by:
getQueryCachePutCount in interface Statistics

getUpdateTimestampsCacheHitCount

public long getUpdateTimestampsCacheHitCount()
Deprecated. 
Description copied from interface: Statistics
Get the global number of timestamps successfully retrieved from cache

Specified by:
getUpdateTimestampsCacheHitCount in interface Statistics

getUpdateTimestampsCacheMissCount

public long getUpdateTimestampsCacheMissCount()
Deprecated. 
Description copied from interface: Statistics
Get the global number of tables for which no update timestamps was *not* found in cache

Specified by:
getUpdateTimestampsCacheMissCount in interface Statistics

getUpdateTimestampsCachePutCount

public long getUpdateTimestampsCachePutCount()
Deprecated. 
Description copied from interface: Statistics
Get the global number of timestamps put in cache

Specified by:
getUpdateTimestampsCachePutCount in interface Statistics

getFlushCount

public long getFlushCount()
Deprecated. 
Description copied from interface: Statistics
Get the global number of flush executed by sessions (either implicit or explicit)

Specified by:
getFlushCount in interface Statistics
See Also:
Statistics.getFlushCount()

getConnectCount

public long getConnectCount()
Deprecated. 
Description copied from interface: Statistics
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)

Specified by:
getConnectCount in interface Statistics
See Also:
Statistics.getConnectCount()

getSecondLevelCacheHitCount

public long getSecondLevelCacheHitCount()
Deprecated. 
Description copied from interface: Statistics
Global number of cacheable entities/collections successfully retrieved from the cache

Specified by:
getSecondLevelCacheHitCount in interface Statistics
See Also:
Statistics.getSecondLevelCacheHitCount()

getSecondLevelCacheMissCount

public long getSecondLevelCacheMissCount()
Deprecated. 
Description copied from interface: Statistics
Global number of cacheable entities/collections not found in the cache and loaded from the database.

Specified by:
getSecondLevelCacheMissCount in interface Statistics
See Also:
Statistics.getSecondLevelCacheMissCount()

getSecondLevelCachePutCount

public long getSecondLevelCachePutCount()
Deprecated. 
Description copied from interface: Statistics
Global number of cacheable entities/collections put in the cache

Specified by:
getSecondLevelCachePutCount in interface Statistics
See Also:
Statistics.getSecondLevelCachePutCount()

getNaturalIdCacheStatistics

public NaturalIdCacheStatistics getNaturalIdCacheStatistics(String regionName)
Deprecated. 
Description copied from interface: Statistics
Natural id cache statistics per region

Specified by:
getNaturalIdCacheStatistics in interface Statistics
Parameters:
regionName - region name
Returns:
NaturalIdCacheStatistics

getNaturalIdCacheHitCount

public long getNaturalIdCacheHitCount()
Deprecated. 
Description copied from interface: Statistics
Get the global number of cached naturalId lookups successfully retrieved from cache

Specified by:
getNaturalIdCacheHitCount in interface Statistics

getNaturalIdCacheMissCount

public long getNaturalIdCacheMissCount()
Deprecated. 
Description copied from interface: Statistics
Get the global number of cached naturalId lookups *not* found in cache

Specified by:
getNaturalIdCacheMissCount in interface Statistics

getNaturalIdCachePutCount

public long getNaturalIdCachePutCount()
Deprecated. 
Description copied from interface: Statistics
Get the global number of cacheable naturalId lookups put in cache

Specified by:
getNaturalIdCachePutCount in interface Statistics

getNaturalIdQueryExecutionCount

public long getNaturalIdQueryExecutionCount()
Deprecated. 
Description copied from interface: Statistics
Get the global number of naturalId queries executed against the database

Specified by:
getNaturalIdQueryExecutionCount in interface Statistics

getNaturalIdQueryExecutionMaxTime

public long getNaturalIdQueryExecutionMaxTime()
Deprecated. 
Description copied from interface: Statistics
Get the global maximum query time for naturalId queries executed against the database

Specified by:
getNaturalIdQueryExecutionMaxTime in interface Statistics

getNaturalIdQueryExecutionMaxTimeRegion

public String getNaturalIdQueryExecutionMaxTimeRegion()
Deprecated. 
Description copied from interface: Statistics
Get the region for the maximum naturalId query time

Specified by:
getNaturalIdQueryExecutionMaxTimeRegion in interface Statistics

getSessionCloseCount

public long getSessionCloseCount()
Deprecated. 
Description copied from interface: Statistics
Global number of sessions closed

Specified by:
getSessionCloseCount in interface Statistics
See Also:
Statistics.getSessionCloseCount()

getSessionOpenCount

public long getSessionOpenCount()
Deprecated. 
Description copied from interface: Statistics
Global number of sessions opened

Specified by:
getSessionOpenCount in interface Statistics
See Also:
Statistics.getSessionOpenCount()

getCollectionLoadCount

public long getCollectionLoadCount()
Deprecated. 
Description copied from interface: Statistics
Global number of collections loaded

Specified by:
getCollectionLoadCount in interface Statistics
See Also:
Statistics.getCollectionLoadCount()

getCollectionFetchCount

public long getCollectionFetchCount()
Deprecated. 
Description copied from interface: Statistics
Global number of collections fetched

Specified by:
getCollectionFetchCount in interface Statistics
See Also:
Statistics.getCollectionFetchCount()

getCollectionUpdateCount

public long getCollectionUpdateCount()
Deprecated. 
Description copied from interface: Statistics
Global number of collections updated

Specified by:
getCollectionUpdateCount in interface Statistics
See Also:
Statistics.getCollectionUpdateCount()

getCollectionRemoveCount

public long getCollectionRemoveCount()
Deprecated. 
Description copied from interface: Statistics
Global number of collections removed

Specified by:
getCollectionRemoveCount in interface Statistics
See Also:
Statistics.getCollectionRemoveCount()

getCollectionRecreateCount

public long getCollectionRecreateCount()
Deprecated. 
Description copied from interface: Statistics
Global number of collections recreated

Specified by:
getCollectionRecreateCount in interface Statistics
See Also:
Statistics.getCollectionRecreateCount()

getStartTime

public long getStartTime()
Deprecated. 
Specified by:
getStartTime in interface Statistics
Returns:
start time in ms (JVM standards System.currentTimeMillis())
See Also:
Statistics.getStartTime()

isStatisticsEnabled

public boolean isStatisticsEnabled()
Deprecated. 
Description copied from interface: Statistics
Are statistics logged

Specified by:
isStatisticsEnabled in interface Statistics
See Also:
Statistics.isStatisticsEnabled()

setStatisticsEnabled

public void setStatisticsEnabled(boolean enable)
Deprecated. 
Description copied from interface: Statistics
Enable statistics logs (this is a dynamic parameter)

Specified by:
setStatisticsEnabled in interface Statistics
See Also:
Statistics.setStatisticsEnabled(boolean)

logSummary

public void logSummary()
Deprecated. 
Description copied from interface: Statistics
log in info level the main statistics

Specified by:
logSummary in interface Statistics

getCollectionRoleNames

public String[] getCollectionRoleNames()
Deprecated. 
Description copied from interface: Statistics
Get the names of all collection roles

Specified by:
getCollectionRoleNames in interface Statistics

getEntityNames

public String[] getEntityNames()
Deprecated. 
Description copied from interface: Statistics
Get the names of all entities

Specified by:
getEntityNames in interface Statistics

getQueries

public String[] getQueries()
Deprecated. 
Description copied from interface: Statistics
Get all executed query strings

Specified by:
getQueries in interface Statistics

getSecondLevelCacheRegionNames

public String[] getSecondLevelCacheRegionNames()
Deprecated. 
Description copied from interface: Statistics
Get all second-level cache region names

Specified by:
getSecondLevelCacheRegionNames in interface Statistics

getSuccessfulTransactionCount

public long getSuccessfulTransactionCount()
Deprecated. 
Description copied from interface: Statistics
The number of transactions we know to have been successful

Specified by:
getSuccessfulTransactionCount in interface Statistics

getTransactionCount

public long getTransactionCount()
Deprecated. 
Description copied from interface: Statistics
The number of transactions we know to have completed

Specified by:
getTransactionCount in interface Statistics

getCloseStatementCount

public long getCloseStatementCount()
Deprecated. 
Description copied from interface: Statistics
The number of prepared statements that were released

Specified by:
getCloseStatementCount in interface Statistics

getPrepareStatementCount

public long getPrepareStatementCount()
Deprecated. 
Description copied from interface: Statistics
The number of prepared statements that were acquired

Specified by:
getPrepareStatementCount in interface Statistics

getOptimisticFailureCount

public long getOptimisticFailureCount()
Deprecated. 
Description copied from interface: Statistics
The number of StaleObjectStateExceptions that occurred

Specified by:
getOptimisticFailureCount in interface Statistics

getQueryExecutionMaxTimeQueryString

public String getQueryExecutionMaxTimeQueryString()
Deprecated. 
Description copied from interface: Statistics
Get the query string for the slowest query.

Specified by:
getQueryExecutionMaxTimeQueryString in interface Statistics


Copyright © 2001-2012 Red Hat, Inc. All Rights Reserved.