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.statistics;
18
19 import net.sf.ehcache.CacheException;
20 import net.sf.ehcache.Ehcache;
21 import net.sf.ehcache.Element;
22 import net.sf.ehcache.Statistics;
23
24 /***
25 * A no-op implementation which can be used both as a {@link LiveCacheStatistics} and {@link LiveCacheStatisticsData}
26 *
27 * @author <a href="mailto:asanoujam@terracottatech.com">Abhishek Sanoujam</a>
28 * @since 1.7
29 */
30 public class NullLiveCacheStatisticsData implements LiveCacheStatistics, LiveCacheStatisticsData {
31
32 /***
33 * {@inheritDoc}
34 */
35 public String getCacheName() {
36 return "_unknown_";
37 }
38
39 /***
40 * {@inheritDoc}
41 */
42 public float getAverageGetTimeMillis() {
43 return 0;
44 }
45
46 /***
47 * {@inheritDoc}
48 */
49 public long getCacheHitCount() {
50 return 0;
51 }
52
53 /***
54 * {@inheritDoc}
55 */
56 public long getCacheMissCount() {
57 return 0;
58 }
59
60 /***
61 * {@inheritDoc}
62 */
63 public long getInMemoryMissCount() {
64 return 0;
65 }
66
67 /***
68 * {@inheritDoc}
69 */
70 public long getOffHeapMissCount() {
71 return 0;
72 }
73
74 /***
75 * {@inheritDoc}
76 */
77 public long getOnDiskMissCount() {
78 return 0;
79 }
80
81 /***
82 * {@inheritDoc}
83 */
84 public long getCacheMissCountExpired() {
85 return 0;
86 }
87
88 /***
89 * {@inheritDoc}
90 */
91 public long getEvictedCount() {
92 return 0;
93 }
94
95 /***
96 * {@inheritDoc}
97 */
98 public long getExpiredCount() {
99 return 0;
100 }
101
102 /***
103 * {@inheritDoc}
104 */
105 public long getInMemoryHitCount() {
106 return 0;
107 }
108
109 /***
110 * {@inheritDoc}
111 * @deprecated see {@link #getLocalHeapSize()}
112 */
113 @Deprecated
114 public long getInMemorySize() {
115 return 0;
116 }
117
118 /***
119 * {@inheritDoc}
120 */
121 public long getOffHeapHitCount() {
122 return 0;
123 }
124
125 /***
126 * {@inheritDoc}
127 * @deprecated see {@link #getLocalOffHeapSize()}
128 */
129 @Deprecated
130 public long getOffHeapSize() {
131 return 0;
132 }
133
134 /***
135 * {@inheritDoc}
136 */
137 public long getOnDiskHitCount() {
138 return 0;
139 }
140
141 /***
142 * {@inheritDoc}
143 * @deprecated see {@link #getLocalDiskSize()}
144 */
145 @Deprecated
146 public long getOnDiskSize() {
147 return 0;
148 }
149
150 /***
151 * {@inheritDoc}
152 */
153 public long getLocalHeapSize() {
154 return 0;
155 }
156
157 /***
158 * {@inheritDoc}
159 */
160 public long getLocalOffHeapSize() {
161 return 0;
162 }
163
164 /***
165 * {@inheritDoc}
166 */
167 public long getLocalDiskSize() {
168 return 0;
169 }
170
171 /***
172 * {@inheritDoc}
173 */
174 public long getLocalHeapSizeInBytes() {
175 return 0;
176 }
177
178 /***
179 * {@inheritDoc}
180 */
181 public long getLocalOffHeapSizeInBytes() {
182 return 0;
183 }
184
185 /***
186 * {@inheritDoc}
187 */
188 public long getLocalDiskSizeInBytes() {
189 return 0;
190 }
191
192 /***
193 * {@inheritDoc}
194 */
195 public long getPutCount() {
196 return 0;
197 }
198
199 /***
200 * {@inheritDoc}
201 */
202 public long getRemovedCount() {
203 return 0;
204 }
205
206 /***
207 * {@inheritDoc}
208 */
209 public long getSize() {
210 return 0;
211 }
212
213 /***
214 * {@inheritDoc}
215 */
216 public int getStatisticsAccuracy() {
217 return Statistics.STATISTICS_ACCURACY_NONE;
218 }
219
220 /***
221 * {@inheritDoc}
222 */
223 public String getStatisticsAccuracyDescription() {
224 return "None";
225 }
226
227 /***
228 * {@inheritDoc}
229 */
230 public long getUpdateCount() {
231 return 0;
232 }
233
234 /***
235 * {@inheritDoc}
236 */
237 public boolean isStatisticsEnabled() {
238 return false;
239 }
240
241 /***
242 * {@inheritDoc}
243 */
244 public void addGetTimeMillis(long millis) {
245
246 }
247
248 /***
249 * {@inheritDoc}
250 */
251 public void cacheHitInMemory() {
252
253 }
254
255 /***
256 * {@inheritDoc}
257 */
258 public void cacheHitOffHeap() {
259
260 }
261
262 /***
263 * {@inheritDoc}
264 */
265 public void cacheHitOnDisk() {
266
267 }
268
269 /***
270 * {@inheritDoc}
271 */
272 public void cacheMissExpired() {
273
274 }
275
276 /***
277 * {@inheritDoc}
278 */
279 public void xaCommit() {
280
281 }
282
283 /***
284 * {@inheritDoc}
285 */
286 public void xaRollback() {
287
288 }
289
290 /***
291 * {@inheritDoc}
292 */
293 public void cacheMissNotFound() {
294
295 }
296
297 /***
298 * {@inheritDoc}
299 */
300 public void cacheMissInMemory() {
301
302 }
303
304 /***
305 * {@inheritDoc}
306 */
307 public void cacheMissOffHeap() {
308
309 }
310
311 /***
312 * {@inheritDoc}
313 */
314 public void cacheMissOnDisk() {
315
316 }
317
318 /***
319 * {@inheritDoc}
320 */
321 public void clearStatistics() {
322
323 }
324
325 /***
326 * {@inheritDoc}
327 */
328 public void registerCacheUsageListener(CacheUsageListener cacheUsageListener) throws IllegalStateException {
329
330 }
331
332 /***
333 * {@inheritDoc}
334 */
335
336 public void removeCacheUsageListener(CacheUsageListener cacheUsageListener) throws IllegalStateException {
337
338 }
339
340 /***
341 * {@inheritDoc}
342 */
343 public void setStatisticsAccuracy(int statisticsAccuracy) {
344
345 }
346
347 /***
348 * {@inheritDoc}
349 */
350 public void setStatisticsEnabled(boolean enableStatistics) {
351
352 }
353
354 /***
355 * {@inheritDoc}
356 */
357 public void dispose() {
358
359 }
360
361 /***
362 * {@inheritDoc}
363 */
364 public void notifyElementEvicted(Ehcache cache, Element element) {
365
366 }
367
368 /***
369 * {@inheritDoc}
370 */
371 public void notifyElementExpired(Ehcache cache, Element element) {
372
373 }
374
375 /***
376 * {@inheritDoc}
377 */
378 public void notifyElementPut(Ehcache cache, Element element) throws CacheException {
379
380 }
381
382 /***
383 * {@inheritDoc}
384 */
385
386 public void notifyElementRemoved(Ehcache cache, Element element) throws CacheException {
387
388 }
389
390 /***
391 * {@inheritDoc}
392 */
393 public void notifyElementUpdated(Ehcache cache, Element element) throws CacheException {
394
395 }
396
397 /***
398 * {@inheritDoc}
399 */
400 public void notifyRemoveAll(Ehcache cache) {
401
402 }
403
404 /***
405 * {@inheritDoc}
406 */
407 @Override
408 public Object clone() throws CloneNotSupportedException {
409 super.clone();
410 return this;
411 }
412
413 /***
414 * {@inheritDoc}
415 */
416 public long getMaxGetTimeMillis() {
417 return 0;
418 }
419
420 /***
421 * {@inheritDoc}
422 *
423 * but returns 0, always!
424 */
425 public long getWriterQueueLength() {
426 return 0;
427 }
428
429 /***
430 * {@inheritDoc}
431 */
432 public long getXaCommitCount() {
433 return 0;
434 }
435
436 /***
437 * {@inheritDoc}
438 */
439 public long getXaRollbackCount() {
440 return 0;
441 }
442
443 /***
444 * {@inheritDoc}
445 */
446 public long getMinGetTimeMillis() {
447 return 0;
448 }
449 }