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.impl;
18  
19  import javax.management.ListenerNotFoundException;
20  import javax.management.MBeanNotificationInfo;
21  import javax.management.NotificationFilter;
22  import javax.management.NotificationListener;
23  import javax.management.openmbean.TabularData;
24  
25  import net.sf.ehcache.hibernate.management.api.HibernateStats;
26  
27  /***
28   * Implementation of {@link HibernateStats} that does nothing
29   * 
30   * <p />
31   * 
32   * @author <a href="mailto:asanoujam@terracottatech.com">Abhishek Sanoujam</a>
33   * 
34   */
35  public final class NullHibernateStats implements HibernateStats {
36  
37      /***
38       * Singleton instance.
39       */
40      public static final HibernateStats INSTANCE = new NullHibernateStats();
41  
42      /***
43       * private constructor. No need to create instances of this. Use singleton instance
44       */
45      private NullHibernateStats() {
46          super();
47          // TODO Auto-generated constructor stub
48      }
49  
50      /***
51       * {@inheritDoc}
52       * 
53       * @see net.sf.ehcache.hibernate.management.api.HibernateStats#clearStats()
54       */
55      public void clearStats() {
56          // no-op
57  
58      }
59  
60      /***
61       * {@inheritDoc}
62       * 
63       * @see net.sf.ehcache.hibernate.management.api.HibernateStats#disableStats()
64       */
65      public void disableStats() {
66          // no-op
67  
68      }
69  
70      /***
71       * {@inheritDoc}
72       * 
73       * @see net.sf.ehcache.hibernate.management.api.HibernateStats#enableStats()
74       */
75      public void enableStats() {
76          // no-op
77  
78      }
79  
80      /***
81       * {@inheritDoc}
82       * 
83       * @see net.sf.ehcache.hibernate.management.api.HibernateStats#getCloseStatementCount()
84       */
85      public long getCloseStatementCount() {
86          // no-op
87          return 0;
88      }
89  
90      /***
91       * {@inheritDoc}
92       * 
93       * @see net.sf.ehcache.hibernate.management.api.HibernateStats#getCollectionStats()
94       */
95      public TabularData getCollectionStats() {
96          // no-op
97          return null;
98      }
99  
100     /***
101      * {@inheritDoc}
102      * 
103      * @see net.sf.ehcache.hibernate.management.api.HibernateStats#getConnectCount()
104      */
105     public long getConnectCount() {
106         // no-op
107         return 0;
108     }
109 
110     /***
111      * Not supported right now
112      */
113     public long getDBSQLExecutionSample() {
114         // no-op
115         return 0;
116     }
117 
118     /***
119      * {@inheritDoc}
120      * 
121      * @see net.sf.ehcache.hibernate.management.api.HibernateStats#getEntityStats()
122      */
123     public TabularData getEntityStats() {
124         // no-op
125         return null;
126     }
127 
128     /***
129      * {@inheritDoc}
130      * 
131      * @see net.sf.ehcache.hibernate.management.api.HibernateStats#getFlushCount()
132      */
133     public long getFlushCount() {
134         // no-op
135         return 0;
136     }
137 
138     /***
139      * {@inheritDoc}
140      * 
141      * @see net.sf.ehcache.hibernate.management.api.HibernateStats#getOptimisticFailureCount()
142      */
143     public long getOptimisticFailureCount() {
144         // no-op
145         return 0;
146     }
147 
148     /***
149      * {@inheritDoc}
150      * 
151      * @see net.sf.ehcache.hibernate.management.api.HibernateStats#getPrepareStatementCount()
152      */
153     public long getPrepareStatementCount() {
154         // no-op
155         return 0;
156     }
157 
158     /***
159      * {@inheritDoc}
160      * 
161      * @see net.sf.ehcache.hibernate.management.api.HibernateStats#getQueryExecutionCount()
162      */
163     public long getQueryExecutionCount() {
164         // no-op
165         return 0;
166     }
167 
168     /***
169      * {@inheritDoc}
170      * 
171      * @see net.sf.ehcache.hibernate.management.api.HibernateStats#getQueryExecutionRate()
172      */
173     public double getQueryExecutionRate() {
174         // no-op
175         return 0;
176     }
177 
178     /***
179      * {@inheritDoc}
180      * 
181      * @see net.sf.ehcache.hibernate.management.api.HibernateStats#getQueryExecutionSample()
182      */
183     public long getQueryExecutionSample() {
184         // no-op
185         return 0;
186     }
187 
188     /***
189      * {@inheritDoc}
190      * 
191      * @see net.sf.ehcache.hibernate.management.api.HibernateStats#getQueryStats()
192      */
193     public TabularData getQueryStats() {
194         // no-op
195         return null;
196     }
197 
198     /***
199      * {@inheritDoc}
200      * 
201      * @see net.sf.ehcache.hibernate.management.api.HibernateStats#getSessionCloseCount()
202      */
203     public long getSessionCloseCount() {
204         // no-op
205         return 0;
206     }
207 
208     /***
209      * {@inheritDoc}
210      * 
211      * @see net.sf.ehcache.hibernate.management.api.HibernateStats#getSessionOpenCount()
212      */
213     public long getSessionOpenCount() {
214         // no-op
215         return 0;
216     }
217 
218     /***
219      * {@inheritDoc}
220      * 
221      * @see net.sf.ehcache.hibernate.management.api.HibernateStats#getSuccessfulTransactionCount()
222      */
223     public long getSuccessfulTransactionCount() {
224         // no-op
225         return 0;
226     }
227 
228     /***
229      * {@inheritDoc}
230      * 
231      * @see net.sf.ehcache.hibernate.management.api.HibernateStats#getTransactionCount()
232      */
233     public long getTransactionCount() {
234         // no-op
235         return 0;
236     }
237 
238     /***
239      * {@inheritDoc}
240      * 
241      * @see net.sf.ehcache.hibernate.management.api.HibernateStats#isStatisticsEnabled()
242      */
243     public boolean isStatisticsEnabled() {
244         // no-op
245         return false;
246     }
247 
248     /***
249      * {@inheritDoc}
250      * 
251      * @see net.sf.ehcache.hibernate.management.api.HibernateStats#setStatisticsEnabled(boolean)
252      */
253     public void setStatisticsEnabled(boolean flag) {
254         // no-op
255     }
256 
257     /***
258      * @see net.sf.ehcache.hibernate.management.api.HibernateStats#getCacheRegionStats()
259      */
260     public TabularData getCacheRegionStats() {
261         return null;
262     }
263 
264     /***
265      * @see javax.management.NotificationEmitter#removeNotificationListener(javax.management.NotificationListener, javax.management.NotificationFilter, java.lang.Object)
266      */
267     public void removeNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback)
268             throws ListenerNotFoundException {
269         /***/
270     }
271 
272     /***
273      * @see javax.management.NotificationBroadcaster#addNotificationListener(javax.management.NotificationListener, javax.management.NotificationFilter, java.lang.Object)
274      */
275     public void addNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback)
276             throws IllegalArgumentException {
277         /***/
278     }
279 
280     /***
281      * @see javax.management.NotificationBroadcaster#getNotificationInfo()
282      */
283     public MBeanNotificationInfo[] getNotificationInfo() {
284         return null;
285     }
286 
287     /***
288      * @see javax.management.NotificationBroadcaster#removeNotificationListener(javax.management.NotificationListener)
289      */
290     public void removeNotificationListener(NotificationListener listener) throws ListenerNotFoundException {
291         /***/
292     }
293 }