//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
//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.
| Modifier and Type | Field and Description |
|---|---|
| pack-priv Logger | |
| pack-priv SessionFactory | |
| pack-priv String | |
| pack-priv Statistics |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public long | getCloseStatementCount()
Implements org. |
| public long | getCollectionFetchCount()
Implements org. |
| public long | getCollectionLoadCount()
Implements org. |
| public long | getCollectionRecreateCount()
Implements org. |
| public long | getCollectionRemoveCount()
Implements org. |
| public String[] | getCollectionRoleNames()
Implements org. |
| public CollectionStatistics | getCollectionStatistics(String
collection role role)Implements org. |
| public long | getCollectionUpdateCount()
Implements org. |
| public long | getConnectCount()
Implements org. |
| public long | getEntityDeleteCount()
Implements org. |
| public long | getEntityFetchCount()
Implements org. |
| public long | getEntityInsertCount()
Implements org. |
| public long | getEntityLoadCount()
Implements org. |
| public String[] | getEntityNames()
Implements org. |
| public EntityStatistics | getEntityStatistics(String
entity name entityName)Implements org. |
| public long | getEntityUpdateCount()
Implements org. |
| public long | getFlushCount()
Implements org. |
| public long | getOptimisticFailureCount()
Implements org. |
| public long | getPrepareStatementCount()
Implements org. |
| public String[] | |
| public long | getQueryCacheHitCount()
Implements org. |
| public long | getQueryCacheMissCount()
Implements org. |
| public long | getQueryCachePutCount()
Implements org. |
| public long | getQueryExecutionCount()
Implements org. |
| public long | getQueryExecutionMaxTime()
Implements org. |
| public String | getQueryExecutionMaxTimeQueryString()
Implements org. |
| public QueryStatistics | getQueryStatistics(String
query string hql)Implements org. |
| public long | getSecondLevelCacheHitCount()
Implements org. |
| public long | getSecondLevelCacheMissCount()
Implements org. |
| public long | getSecondLevelCachePutCount()
Implements org. |
| public String[] | getSecondLevelCacheRegionNames()
Implements org. |
| public SecondLevelCacheStatistics | getSecondLevelCacheStatistics(String
region name regionName)Implements org. |
| public long | getSessionCloseCount()
Implements org. |
| public long | getSessionOpenCount()
Implements org. |
| public long | |
| public long | getSuccessfulTransactionCount()
Implements org. |
| public long | getTransactionCount()
Implements org. |
| public boolean | isStatisticsEnabled()
Implements org. |
| public void | logSummary()
Implements org. |
| public void | setSessionFactory(SessionFactory
session factory to register sf)Useful to init this MBean wo a JNDI session factory name |
| public void | setSessionFactoryJNDIName(String
session factory jndi name sfJNDIName)Implements org. |
| public void | setStatisticsEnabled(boolean enable)
Implements org. |
| log | back to summary |
|---|---|
| pack-priv Logger log | |
| sf | back to summary |
|---|---|
| pack-priv SessionFactory sf | |
| sfJNDIName | back to summary |
|---|---|
| pack-priv String sfJNDIName | |
| stats | back to summary |
|---|---|
| pack-priv Statistics stats | |
| StatisticsService | back to summary |
|---|---|
| public StatisticsService() | |
| clear | back to summary |
|---|---|
| public void clear() Implements org. Doc from org. reset all statistics
| |
| getCloseStatementCount | back to summary |
|---|---|
| public long getCloseStatementCount() Implements org. Doc from org. The number of prepared statements that were released | |
| getCollectionFetchCount | back to summary |
|---|---|
| public long getCollectionFetchCount() Implements org. Doc from org. Global number of collections fetched | |
| getCollectionLoadCount | back to summary |
|---|---|
| public long getCollectionLoadCount() Implements org. Doc from org. Global number of collections loaded | |
| getCollectionRecreateCount | back to summary |
|---|---|
| public long getCollectionRecreateCount() Implements org. Doc from org. Global number of collections recreated | |
| getCollectionRemoveCount | back to summary |
|---|---|
| public long getCollectionRemoveCount() Implements org. Doc from org. Global number of collections removed | |
| getCollectionRoleNames | back to summary |
|---|---|
| public String[] getCollectionRoleNames() Implements org. Doc from org. Get the names of all collection roles | |
| getCollectionStatistics | back to summary |
|---|---|
| public CollectionStatistics getCollectionStatistics(String role) Implements org. Doc from org. Get collection statistics per role
| |
| getCollectionUpdateCount | back to summary |
|---|---|
| public long getCollectionUpdateCount() Implements org. Doc from org. Global number of collections updated | |
| getConnectCount | back to summary |
|---|---|
| public long getConnectCount() Implements org. Doc from org. 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) | |
| getEntityDeleteCount | back to summary |
|---|---|
| public long getEntityDeleteCount() Implements org. Doc from org. Get global number of entity deletes
| |
| getEntityFetchCount | back to summary |
|---|---|
| public long getEntityFetchCount() Implements org. Doc from org. Get global number of entity fetchs
| |
| getEntityInsertCount | back to summary |
|---|---|
| public long getEntityInsertCount() Implements org. Doc from org. Get global number of entity inserts
| |
| getEntityLoadCount | back to summary |
|---|---|
| public long getEntityLoadCount() Implements org. Doc from org. Get global number of entity loads
| |
| getEntityNames | back to summary |
|---|---|
| public String[] getEntityNames() Implements org. Doc from org. Get the names of all entities | |
| getEntityStatistics | back to summary |
|---|---|
| public EntityStatistics getEntityStatistics(String entityName) Implements org. Doc from org. find entity statistics per name
| |
| getEntityUpdateCount | back to summary |
|---|---|
| public long getEntityUpdateCount() Implements org. Doc from org. Get global number of entity updates
| |
| getFlushCount | back to summary |
|---|---|
| public long getFlushCount() Implements org. Doc from org. Get the global number of flush executed by sessions (either implicit or explicit) | |
| getOptimisticFailureCount | back to summary |
|---|---|
| public long getOptimisticFailureCount() Implements org. Doc from org. The number of StaleObjectStateExceptions that occurred | |
| getPrepareStatementCount | back to summary |
|---|---|
| public long getPrepareStatementCount() Implements org. Doc from org. The number of prepared statements that were acquired | |
| getQueries | back to summary |
|---|---|
| public String[] getQueries() Implements org. Doc from org. Get all executed query strings | |
| getQueryCacheHitCount | back to summary |
|---|---|
| public long getQueryCacheHitCount() Implements org. Doc from org. Get the global number of cached queries successfully retrieved from cache | |
| getQueryCacheMissCount | back to summary |
|---|---|
| public long getQueryCacheMissCount() Implements org. Doc from org. Get the global number of cached queries *not* found in cache | |
| getQueryCachePutCount | back to summary |
|---|---|
| public long getQueryCachePutCount() Implements org. Doc from org. Get the global number of cacheable queries put in cache | |
| getQueryExecutionCount | back to summary |
|---|---|
| public long getQueryExecutionCount() Implements org. Doc from org. Get global number of executed queries
| |
| getQueryExecutionMaxTime | back to summary |
|---|---|
| public long getQueryExecutionMaxTime() Implements org. Doc from org. Get the time in milliseconds of the slowest query. | |
| getQueryExecutionMaxTimeQueryString | back to summary |
|---|---|
| public String getQueryExecutionMaxTimeQueryString() Implements org. Doc from org. Get the query string for the slowest query. | |
| getQueryStatistics | back to summary |
|---|---|
| public QueryStatistics getQueryStatistics(String hql) Implements org. Doc from org. Query statistics from query string (HQL or SQL)
| |
| getSecondLevelCacheHitCount | back to summary |
|---|---|
| public long getSecondLevelCacheHitCount() Implements org. Doc from org. Global number of cacheable entities/collections successfully retrieved from the cache | |
| getSecondLevelCacheMissCount | back to summary |
|---|---|
| public long getSecondLevelCacheMissCount() Implements org. Doc from org. Global number of cacheable entities/collections not found in the cache and loaded from the database. | |
| getSecondLevelCachePutCount | back to summary |
|---|---|
| public long getSecondLevelCachePutCount() Implements org. Doc from org. Global number of cacheable entities/collections put in the cache | |
| getSecondLevelCacheRegionNames | back to summary |
|---|---|
| public String[] getSecondLevelCacheRegionNames() Implements org. Doc from org. Get all second-level cache region names | |
| getSecondLevelCacheStatistics | back to summary |
|---|---|
| public SecondLevelCacheStatistics getSecondLevelCacheStatistics(String regionName) Implements org. Doc from org. Second level cache statistics per region
| |
| getSessionCloseCount | back to summary |
|---|---|
| public long getSessionCloseCount() Implements org. Doc from org. Global number of sessions closed | |
| getSessionOpenCount | back to summary |
|---|---|
| public long getSessionOpenCount() Implements org. Doc from org. Global number of sessions opened | |
| getStartTime | back to summary |
|---|---|
| public long getStartTime() Implements org.
| |
| getSuccessfulTransactionCount | back to summary |
|---|---|
| public long getSuccessfulTransactionCount() Implements org. Doc from org. The number of transactions we know to have been successful | |
| getTransactionCount | back to summary |
|---|---|
| public long getTransactionCount() Implements org. Doc from org. The number of transactions we know to have completed | |
| isStatisticsEnabled | back to summary |
|---|---|
| public boolean isStatisticsEnabled() Implements org. Doc from org. Are statistics logged | |
| logSummary | back to summary |
|---|---|
| public void logSummary() Implements org. Doc from org. log in info level the main statistics | |
| setSessionFactory | back to summary |
|---|---|
| public void setSessionFactory(SessionFactory sf) Useful to init this MBean wo a JNDI session factory name
| |
| setSessionFactoryJNDIName | back to summary |
|---|---|
| public void setSessionFactoryJNDIName(String sfJNDIName) Implements org. Doc from org. Publish the statistics of a session factory bound to the default JNDI context
| |
| setStatisticsEnabled | back to summary |
|---|---|
| public void setStatisticsEnabled(boolean enable) Implements org. Doc from org. Enable statistics logs (this is a dynamic parameter) | |