View Javadoc

1   /***
2    *  Copyright 2003-2010 Terracotta, Inc.
3    *
4    *  Licensed under the Apache License, Version 2.0 (the "License");
5    *  you may not use this file except in compliance with the License.
6    *  You may obtain a copy of the License at
7    *
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    *
10   *  Unless required by applicable law or agreed to in writing, software
11   *  distributed under the License is distributed on an "AS IS" BASIS,
12   *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   *  See the License for the specific language governing permissions and
14   *  limitations under the License.
15   */
16  
17  package net.sf.ehcache.hibernate.management.api;
18  
19  import javax.management.NotificationEmitter;
20  import javax.management.openmbean.TabularData;
21  
22  /***
23   * Interface for hibernate related statistics of hibernate second level cache
24   * 
25   * <p />
26   * 
27   * @author <a href="mailto:asanoujam@terracottatech.com">Abhishek Sanoujam</a>
28   * 
29   */
30  public interface HibernateStats extends NotificationEmitter {
31      /***
32       * CACHE_ENABLED
33       */
34      public static final String CACHE_ENABLED = "CacheEnabled";
35      
36      /***
37       * CACHE_REGION_CHANGED
38       */
39      public static final String CACHE_REGION_CHANGED = "CacheRegionChanged";
40      
41      /***
42       * CACHE_FLUSHED
43       */
44      public static final String CACHE_FLUSHED = "CacheFlushed";
45      
46      /***
47       * CACHE_REGION_FLUSHED
48       */
49      public static final String CACHE_REGION_FLUSHED = "CacheRegionFlushed";
50      
51      /***
52       * CACHE_STATISTICS_ENABLED
53       */
54      public static final String CACHE_STATISTICS_ENABLED = "CacheStatisticsEnabled";
55      
56      /***
57       * CACHE_STATISTICS_RESET
58       */
59      public static final String CACHE_STATISTICS_RESET = "CacheStatisticsReset";
60  
61      /***
62       * Returns true if statistics collection is enabled otherwise false
63       * 
64       * @return Returns true if statistics collection is enabled otherwise false
65       */
66      boolean isStatisticsEnabled();
67  
68      /***
69       * Enable/Disable statistics collection
70       * 
71       * @param flag
72       */
73      void setStatisticsEnabled(boolean flag);
74  
75      /***
76       * Enables statistics collection
77       */
78      void enableStats();
79  
80      /***
81       * Disables statistics collection
82       */
83      void disableStats();
84  
85      /***
86       * Clears statistics, resets all counters to zero
87       */
88      void clearStats();
89  
90      /***
91       * Returns the query execution count. This includes only HQL's
92       * 
93       * @return Returns the query execution count. This includes only HQL's
94       */
95      long getQueryExecutionCount();
96  
97      // /***
98      // * Returns last count sample of <b>all SQL's</b> getting executed in the DB.
99      // */
100     // long getDBSQLExecutionSample();
101 
102     /***
103      * Returns last count sample of <b>HQL's</b> getting executed in the DB.
104      * 
105      * @return Returns last count sample of <b>HQL's</b> getting executed in the DB.
106      */
107     long getQueryExecutionSample();
108 
109     /***
110      * Returns rate of HQL query executed in the DB
111      * 
112      * @return Returns rate of HQL query executed in the DB
113      */
114     double getQueryExecutionRate();
115 
116     /***
117      * Returns the count of close statements
118      * 
119      * @return Returns the count of close statementss
120      */
121     long getCloseStatementCount();
122 
123     /***
124      * Return connect counts
125      * 
126      * @return Return connect counts
127      */
128     long getConnectCount();
129 
130     /***
131      * Returns flush count
132      * 
133      * @return Returns flush count
134      */
135     long getFlushCount();
136 
137     /***
138      * Returns Optimistic failure count
139      * 
140      * @return Returns Optimistic failure count
141      */
142     long getOptimisticFailureCount();
143 
144     /***
145      * Returns prepare statement count
146      * 
147      * @return Returns prepare statement count
148      */
149     long getPrepareStatementCount();
150 
151     /***
152      * Returns session close count
153      * 
154      * @return Returns session close count
155      */
156     long getSessionCloseCount();
157 
158     /***
159      * Returns session open count
160      * 
161      * @return Returns session open count
162      */
163     long getSessionOpenCount();
164 
165     /***
166      * Returns successful transaction count
167      * 
168      * @return Returns successful transaction count
169      */
170     long getSuccessfulTransactionCount();
171 
172     /***
173      * Returns transaction count
174      * 
175      * @return Returns transaction count
176      */
177     long getTransactionCount();
178 
179     /***
180      * Returns {@link TabularData} of entity stats
181      * 
182      * @return Returns {@link TabularData} of entity stats
183      */
184     TabularData getEntityStats();
185 
186     /***
187      * Returns {@link TabularData} of collection stats
188      * 
189      * @return Returns {@link TabularData} of collection stats
190      */
191     TabularData getCollectionStats();
192 
193     /***
194      * Returns {@link TabularData} of query stats
195      * 
196      * @return Returns {@link TabularData} of query stats
197      */
198     TabularData getQueryStats();
199 
200     /***
201      * Returns {@link TabularData} of cache region stats
202      * 
203      * @return Returns {@link TabularData} of cache region stats
204      */
205     TabularData getCacheRegionStats();    
206 }