KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > dods > cache > DataStructCacheImpl


1 /*
2  * Enhydra Java Application Server Project
3  *
4  * The contents of this file are subject to the Enhydra Public License
5  * Version 1.1 (the "License"); you may not use this file except in
6  * compliance with the License. You may obtain a copy of the License on
7  * the Enhydra web site ( http://www.enhydra.org/ ).
8  *
9  * Software distributed under the License is distributed on an "AS IS"
10  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
11  * the License for the specific terms governing rights and limitations
12  * under the License.
13  *
14  * The Initial Developer of the Enhydra Application Server is Lutris
15  * Technologies, Inc. The Enhydra Application Server and portions created
16  * by Lutris Technologies, Inc. are Copyright Lutris Technologies, Inc.
17  * All Rights Reserved.
18  *
19  */

20 package org.enhydra.dods.cache;
21
22 import java.util.HashMap JavaDoc;
23 import java.util.Map JavaDoc;
24
25 import org.enhydra.dods.DODS;
26 import org.enhydra.dods.cache.base.BaseCacheManager;
27 import org.enhydra.dods.cache.base.DODSCache;
28 import org.enhydra.dods.exceptions.CacheObjectException;
29 import org.enhydra.dods.statistics.CacheStatistics;
30 import org.enhydra.dods.statistics.Statistics;
31 import org.enhydra.dods.statistics.TableStatistics;
32
33 import com.lutris.appserver.server.sql.CoreDataStruct;
34 import com.lutris.appserver.server.sql.standard.DatabaseConfiguration;
35 import com.lutris.appserver.server.sql.standard.StandardLogicalDatabase;
36 import com.lutris.util.Config;
37
38 /**
39  * This class contains data and mechanisms needed for caching data objects (or
40  * DataStruct objects) by their OIDs and provides cache configuration and
41  * administration.
42  *
43  * @author Tanja Jovanovic
44  * @author Nenad Vico
45  * @author Zorica Suvajdzin
46  * @version 2.0 15.06.2003.
47  */

48 public class DataStructCacheImpl extends DataStructCache {
49
50     /**
51      * LRU cache for storing data (or DataStruct) objects. LRU cache keys are
52      * cache handles (String "<database_name>.<String_presentation_of_oid>"),
53      * and LRU cache values are data (or DataStruct) objects.
54      */

55     protected DODSCache cache = null;
56
57     /**
58      * cacheAdministration attribute handles configuration settings about data
59      * (or DataStruct) object cache.
60      */

61     protected CacheAdministration cacheAdministration = null;
62
63     /**
64      * TableConfiguration attribute handles configuration settings about table
65      * of this cache.
66      */

67     protected TableConfiguration tableConf = new TableConfiguration();
68
69     /**
70      * Initial query statement. This attribute contains "where" clause which is
71      * used during data (or DataStruct) object cache initialization.
72      * If this attribute is set to "*", all rows from the table (in database)
73      * will be put in the cache.
74      */

75     protected String JavaDoc initialQueryCache = null;
76
77     /**
78      * This attribute contains information if multi databases are used.
79      */

80     protected boolean multi = false;
81
82     /**
83      * This attribute is true if the cache is full, otherwise false.
84      */

85     protected boolean fullCachingOn = false;
86     
87     /**
88      * Table and cache statictics.
89      */

90     protected Statistics statistics = null;
91
92     /**
93      * List of objects that are unvisible in the cache at the moment. Keys of
94      * this map sre cache handles
95      * (String "<database_name>.<String_presentation_of_oid>"),
96      * and values are counters of how many transactions have made object with
97      * that cache handle invisible.
98      */

99     protected HashMap JavaDoc nonVisibleList = null;
100
101     /**
102      * Reserve factor used in in query caching. Since there is only data object
103      * (or DataStruct object) cache, without query caches, this parameter is not
104      * used.
105      */

106     protected double reserveFactor = 0;
107     protected double cachePercentage = -1;
108
109     /**
110      * True if the cache is disabled, otherwise false.
111      */

112     private boolean isDisabled = false;
113
114     /**
115      * Contains maximal cache size before it was disabled.
116      */

117     private int disabledMaxCacheSize = 0;
118     
119     
120
121     private int initialCacheFetchSize = CacheConstants.DEFAULT_INITIAL_CACHE_FETCH_SIZE;
122
123     private int initialDSCacheSize = CacheConstants.DEFAULT_INITIAL_DS_CACHE_SIZE;
124
125
126
127     /**
128      * Constructor(int).
129      * Creates data (or DataStruct) object cache with maximal size <code>maxCSize</code>.
130      *
131      * @param maxCSize maximal data (or DataStruct) object cache size.
132      */

133     public DataStructCacheImpl(int maxCSize) throws CacheObjectException {
134         if (isDisabled) {
135             throw new CacheObjectException("Caching is disabled");
136         }
137         cache = BaseCacheManager.getDODSCache(maxCSize);
138         statistics = new DataStructCacheImplStatistics();
139         nonVisibleList = new HashMap JavaDoc();
140         init();
141     }
142
143     /**
144      * Constructor().
145      * Creates data (or DataStruct) object cache with its default maximal size
146      * (the value of CacheConstants.DEFAULT_MAX_CACHE_SIZE is 10000).
147      */

148     public DataStructCacheImpl() throws CacheObjectException {
149         this(CacheConstants.DEFAULT_MAX_CACHE_SIZE);
150     }
151
152     /**
153      * Returns CacheAdministration for data (or DataStruct) object cache.
154      * Parameter cacheType can have one of these values:
155      * 0 - for CacheAdministration of data (or DataStruct) object cache
156      * 1 - for CacheAdministration of simple query cache
157      * 2 - for CacheAdministration of complex query cache
158      * There is only one cache (data (or DataStruct) object), so there is only
159      * one CacheAdministration. This method always returns this
160      * CacheAdministration, no matter what value does parameter cacheType have.
161      *
162      * @param cacheType Type of caching. In this case, it is 0, but, since there
163      * is only one cache (data (or DataStruct) object), parameter is not checked,
164      * always is the same CacheAdministration object returned.
165      * @return CacheAdministration for data (or DataStruct) object cache.
166      */

167     public CacheAdministration getCacheAdministration(int cacheType) {
168         return cacheAdministration;
169     }
170
171     /**
172      * Returns initialQueryCache. This attribute contains "where" clause
173      * which is used during data object (or DataStruct object) cache
174      * initialization.
175      *
176      * @return initialQueryCache.
177      */

178     public String JavaDoc getInitialQueryCache() {
179         return initialQueryCache;
180     }
181
182     /**
183      * Sets initialQueryCache attribute. This attribute contains "where" clause
184      * which is used during data object (or DataStruct object) cache
185      * initialization.
186      *
187      * @param initQ New value of initialQueryCache attribute.
188      */

189     protected void setInitialQueryCache(String JavaDoc initQ) {
190         initialQueryCache = initQ;
191     }
192
193     public void makeInvisible(String JavaDoc cacheHandle) {
194         Integer JavaDoc intObj = (Integer JavaDoc) nonVisibleList.get(cacheHandle);
195         int num;
196
197         if (intObj != null) {
198             num = intObj.intValue();
199             num++;
200             nonVisibleList.put(cacheHandle, new Integer JavaDoc(num));
201         } else {
202             nonVisibleList.put(cacheHandle, new Integer JavaDoc(1));
203         }
204     }
205
206     public void makeVisible(String JavaDoc cacheHandle) {
207         Integer JavaDoc intObj = (Integer JavaDoc) nonVisibleList.get(cacheHandle);
208         int num;
209
210         if (intObj != null) {
211             num = intObj.intValue();
212             num--;
213             if (num == 0) {
214                 nonVisibleList.remove(cacheHandle);
215             } else {
216                 nonVisibleList.put(cacheHandle, new Integer JavaDoc(num));
217             }
218         }
219     }
220
221     /**
222      * Returns statistics of used table and cache.
223      *
224      * @return statistics of used table and cache.
225      */

226     public Statistics getStatistics() {
227         statistics.stopTime();
228         return statistics;
229     }
230
231     /**
232      * Refreshes statistics.
233      */

234     public void refreshStatistics() {
235         statistics.clear();
236     }
237
238     /**
239      * Returns information if data object (or DataStruct object) cache if "full".
240      * "Full" cache contains all data objects (or DataStruct objects) from
241      * the table. The cache is "full", if data (or DataStruct) object cache is
242      * unbounded, if the cached table is read-only, and if initialQueryCache
243      * attribute is set to "*".
244      *
245      * @return true if data object (or DataStruct object) cache if "full",
246      * otherwise false.
247      */

248     public void checkFull() {
249         if ((cacheAdministration.getMaxCacheSize() < 0)
250                 && (getInitialQueryCache() != null)
251                 && (getInitialQueryCache().equals("*"))) {
252             fullCachingOn = true;
253         } else {
254             fullCachingOn = false;
255         }
256     }
257
258     /**
259      * Returns information if data object (or DataStruct object) cache if "full".
260      * "Full" cache contains all data objects (or DataStruct objects) from
261      * the table. The cache is "full", if data (or DataStruct) object cache is
262      * unbounded, and if initialQueryCache attribute is set to "*".
263      *
264      * @return true if data object (or DataStruct object) cache if "full",
265      * otherwise false.
266      */

267     public boolean isFull() {
268         if (fullCachingOn) {
269             checkFull();
270         }
271         return fullCachingOn;
272     }
273
274     /**
275      * Returns data object (or DataStruct object) cache type.
276      * Possible values are:
277      * "none" - no caching available
278      * "lru" - cache with LRU (least-recently used) algorithm
279      * "full" - special case of LRU cache - the whole table is cached
280      *
281      * @return data object (or DataStruct object) cache type.
282      */

283     public String JavaDoc getCacheType() {
284         if (cacheAdministration.getMaxCacheSize() == 0) {
285             return "none";
286         } else {
287             if (isFull()) {
288                 return "full";
289             } else {
290                 return "lru";
291             }
292         }
293     }
294
295     /**
296      * Returns caching level.
297      * Possible values:
298      * org.enhydra.dods.cache.CacheConstants.DATA_CACHING (value 1) for data (or
299      * DataStruct) object caching without query caching, and
300      * org.enhydra.dods.cache.CacheConstants.QUERY_CACHING (value 2) for data (or
301      * DataStruct) object caching with query caching.
302      * This is data (or DataStruct) object cache without query caching, so this
303      * method returns CacheConstants.DATA_CACHING (value 1).
304      *
305      * @return value 1 (org.enhydra.dods.cache.CacheConstants.DATA_CACHING).
306      */

307     public int getLevelOfCaching() {
308         return CacheConstants.DATA_CACHING;
309     }
310
311     /**
312      * Returns TableConfiguration.
313      *
314      * @return TableConfiguration attribute.
315      */

316     public TableConfiguration getTableConfiguration() {
317         return tableConf;
318     }
319
320     /**
321      * Returns reserveFactor.
322      * Reserve factor used in in query caching. Since there is only data object
323      * (or DataStruct object) cache, without query caches, this method returns 0.
324      *
325      * @return value 0.
326      */

327     public double getReserveFactor() {
328         return 0;
329     }
330
331     /**
332      * Sets reserveFactor.
333      * Reserve factor used in in query caching. Since there is only data object
334      * (or DataStruct object) cache, without query caches, this method does not
335      * do anything.
336      *
337      * @param res New reserveFactor.
338      */

339     protected void setReserveFactor(double res) {}
340
341     /**
342      *
343      */

344     protected void setCachePercentage(double percent) {
345         cachePercentage = percent;
346     }
347
348     /**
349      *
350      */

351     public double getCachePercentage() {
352         return cachePercentage;
353     }
354
355     /**
356      * Returns information whether the cache is disabled.
357      *
358      * @return true is the cache is disabled, otherwise false.
359      */

360     public boolean isDisabled() {
361         return isDisabled;
362     }
363
364     /**
365      * Reads table and cache configuration from application's configuration file.
366      *
367      * @param tableConfig configuration for table of this cache.
368      * @param cacheConfig configuration for this cache.
369      */

370     public void readConfiguration(Config tableConfig, Config cacheConfig, String JavaDoc dbName) throws CacheObjectException {
371         if (isDisabled) {
372             throw new CacheObjectException("Caching is disabled");
373         }
374         int maxSize = CacheConstants.DEFAULT_MAX_CACHE_SIZE;
375         boolean initialAllCaches = CacheConstants.DEFAULT_INITIAL_ALL_CACHES;
376         Config defaultCacheConfig = null;
377
378         this.tableConf.readTableConfiguration(tableConfig, dbName);
379         DatabaseConfiguration dbConf;
380
381         try {
382             dbConf = ((StandardLogicalDatabase) (DODS.getDatabaseManager().findLogicalDatabase(dbName))).getDatabaseConfiguration();
383         } catch (Exception JavaDoc ex) {
384             throw new CacheObjectException("Error reading database configuration");
385         }
386         if (dbConf != null) {
387             try {
388                 maxSize = dbConf.getMaxCacheSize();
389             } catch (Exception JavaDoc e) {}
390             try {
391                 reserveFactor = dbConf.getReserveFactor();
392             } catch (Exception JavaDoc e) {}
393             try {
394                 cachePercentage = dbConf.getCachePercentage();
395             } catch (Exception JavaDoc e) {}
396             try {
397                 initialAllCaches = dbConf.getInitAllCaches();
398             } catch (Exception JavaDoc e) {}
399             try {
400                 initialCacheFetchSize = dbConf.getInitialCacheFetchSize ();
401             } catch (Exception JavaDoc e) {}
402             try {
403                 initialDSCacheSize = dbConf.getInitialDSCacheSize();
404             } catch (Exception JavaDoc e) {}
405         }
406         if (cacheConfig != null) {
407             try {
408                 maxSize = cacheConfig.getInt(CacheConstants.PARAMNAME_MAX_CACHE_SIZE);
409             } catch (Exception JavaDoc e) {}
410             try {
411                 initialQueryCache = cacheConfig.getString(CacheConstants.PARAMNAME_INITIAL_CONDITION);
412             } catch (Exception JavaDoc e) {
413                 if (initialAllCaches) {
414                     initialQueryCache = "*";
415                 }
416             }
417             try {
418                 reserveFactor = cacheConfig.getDouble(CacheConstants.PARAMNAME_RESERVE_FACTOR);
419             } catch (Exception JavaDoc e) {}
420             try {
421                 cachePercentage = cacheConfig.getDouble(CacheConstants.PARAMNAME_CACHE_PERCENTAGE);
422             } catch (Exception JavaDoc e) {}
423             try {
424                 initialCacheFetchSize = cacheConfig.getInt(CacheConstants.PARAMNAME_INITIAL_CACHE_FETCH_SIZE);
425             } catch (Exception JavaDoc e) {}
426             try {
427                 initialDSCacheSize = cacheConfig.getInt(CacheConstants.PARAMNAME_INITIAL_DS_CACHE_SIZE);
428             } catch (Exception JavaDoc e) {}
429         } else if (initialAllCaches) {
430             initialQueryCache = "*";
431         }
432         cacheAdministration.setMaxCacheSize(maxSize);
433     }
434
435     /**
436      * Creates DataStructCacheImpl instance.
437      *
438      * @return created DataStructCacheImpl instance as DataStructCache.
439      */

440     public DataStructCache newInstance() throws CacheObjectException {
441         if (isDisabled) {
442             throw new CacheObjectException("Caching is disabled");
443         }
444         return new DataStructCacheImpl();
445     }
446
447     /**
448      * Creates cacheAdministration object for data (or DataStruct) object cache.
449      */

450     protected void init() {
451         cacheAdministration = new CacheAdministration() {
452
453             /**
454              * Returns maximum cache size.
455              *
456              * @return Maximum cache size.
457              */

458             public int getMaxCacheSize() {
459                 if (cache != null) {
460                     return cache.getMaxEntries();
461                 }
462                 return 0;
463             }
464
465             /**
466              * Returns maximum cache size. If the cache is unbounded (the
467              * maximum size is negative), the current cache size is returned.
468              *
469              * @param real If this parameter is true, method returns real maximum
470              * cache size, otherwise returns appropriate value for statistics.
471              * @return Maximum cache size.
472              */

473             public int getMaxCacheSize(boolean real) {
474                 int size = getMaxCacheSize();
475
476                 if (size < 0) {
477                     if (real) {
478                         return -1;
479                     } else {
480                         return getCacheSize();
481                     }
482                 }
483                 return size;
484             }
485
486             /**
487              * Returns size of currently used cache (number of objects in the
488              * cache).
489              *
490              * @return Size of currently used cache.
491              */

492             public int getCacheSize() {
493                 if (cache != null) {
494                     return cache.size();
495                 }
496                 return 0;
497             }
498
499             /**
500              * Sets maximum cache size.
501              *
502              * @param maxSize Maximum cache size.
503              */

504             protected void setMaxCacheSize(int maxSize) throws CacheObjectException {
505                 if (isDisabled) {
506                     throw new CacheObjectException("Caching is disabled");
507                 }
508                 if (maxSize == 0) {
509                     cache = null;
510                     statistics.clear();
511                     return;
512                 }
513                 if (cache == null) {
514                     cache = BaseCacheManager.getDODSCache(maxSize);
515                 } else {
516                     cache.setMaxEntries(maxSize);
517                 }
518             }
519
520             /**
521              * Refreshes cache.
522              */

523             public void refresh() {
524                 if (cache != null) {
525                     cache = BaseCacheManager.getDODSCache(cache.getMaxEntries());
526                     statistics.clear();
527                 }
528             }
529
530             /**
531              * Disables cache.
532              */

533             public void disable() {
534                 if (!isDisabled) {
535                     isDisabled = true;
536                     if (cache != null) {
537                         disabledMaxCacheSize = cache.getMaxEntries();
538                         statistics.clear();
539                     }
540                 }
541             }
542
543             /**
544              * Enables cache.
545              */

546             public void enable() {
547                 if (isDisabled) {
548                     if (disabledMaxCacheSize != 0) {
549                         cache = BaseCacheManager.getDODSCache(disabledMaxCacheSize);
550                     }
551                     statistics.clear();
552                     isDisabled = false;
553                 }
554             }
555         };
556     }
557
558     /**
559      * Returns cache (data or DataStruct) content.
560      *
561      * @return Cache content as <code>Map</code> of data (or DataStruct) object.
562      */

563     public Map JavaDoc getCacheContent() {
564         return cache;
565     }
566
567     /**
568      * Returns information if multi databases are supported.
569      *
570      * @return true if multi databases are used, otherwise false.
571      */

572     public boolean isMulti() {
573         return multi;
574     }
575
576     /**
577      * Checks wheather cache reconfiguration needs to be done.
578      *
579      * @return true if cache reconfiguration needs to be done, otherwise false.
580      */

581     public boolean toReconfigure() {
582         return false;
583     }
584
585     /**
586      * Adds DataStruct object to the cache.
587      *
588      * @param newDS DataStruct object that will be added to the cache.
589      *
590      * @return Added DataStruct object.
591      */

592     public synchronized CoreDataStruct addDataStruct(CoreDataStruct newDS) {
593         if (cache == null) {
594             return newDS;
595         }
596         try {
597             String JavaDoc handle = newDS.get_CacheHandle();
598
599             cache.add(handle, newDS);
600             return newDS;
601         } catch (Exception JavaDoc e) {
602             e.printStackTrace();
603         }
604         return null;
605     }
606
607     /**
608      * Removes DataStruct object from the cache.
609      *
610      * @param data DataStruct object that will be removed from the cache.
611      *
612      * @return Removed DataStruct object, or <tt>null</tt> if there was no
613      * object removed from the cache.
614      */

615     public synchronized CoreDataStruct removeDataStruct(CoreDataStruct data) {
616         if (cache != null) {
617             try {
618                 String JavaDoc handle = data.get_CacheHandle();
619
620                 return (CoreDataStruct) cache.remove(handle);
621             } catch (Exception JavaDoc e) {}
622         }
623         return null;
624     }
625
626     /**
627      * Removes DataStruct object from the cache.
628      *
629      * @param handle Cache handle of DataStruct object that will be removed from
630      * the cache. The form of cache handle is:
631      * "<database_name>.<String_presentation_of_oid>".
632      *
633      * @return Removed DataStruct object, or <tt>null</tt> if there was no
634      * object removed from the cache.
635      */

636     public synchronized CoreDataStruct removeDataStruct(String JavaDoc handle) {
637         if (cache != null) {
638             try {
639                 return (CoreDataStruct) cache.remove(handle);
640             } catch (Exception JavaDoc e) {}
641         }
642         return null;
643     }
644
645     /**
646      * Updates cached DataStruct object, or inserts it in the cache if it didn't
647      * exist in the cache.
648      *
649      * @param data DataStruct object that will be updated (or inserted if didn't
650      * exist in the cache).
651      *
652      * @return Updated or inserted DataStruct object.
653      */

654     public CoreDataStruct updateDataStruct(CoreDataStruct data) {
655         data = addDataStruct(data);
656         return data;
657     }
658
659     /**
660      * Deletes DataStruct object from the cache.
661      *
662      * @param data DataStruct object that will be deleted from the cache.
663      *
664      * @return Deleted DataStruct object, or <tt>null</tt> if there was no
665      * object deleted from the cache.
666      */

667     public CoreDataStruct deleteDataStruct(CoreDataStruct data) {
668         CoreDataStruct oldData = removeDataStruct(data);
669
670         return oldData;
671     }
672
673     /**
674      * Returns DataStruct object whose String representation of OID is parameter
675      * handle.
676      *
677      * @param handle String representation of OID of DataStruct object that is
678      * being searched in the cache.
679      *
680      * @return DataStruct object whose String representation of OID is handle.
681      */

682     public CoreDataStruct getDataStructByHandle(String JavaDoc handle) {
683         if (cache == null) {
684             return null;
685         }
686         CoreDataStruct cdt = null;
687         if(cache.isNeedToSynchronize()) {
688             synchronized (cache) {
689                 cdt = getDataCacheItem(handle, cdt);
690             }
691         }else {
692             cdt = getDataCacheItem(handle, cdt);
693         }
694         return cdt;
695     }
696
697     /**
698      * @param handle
699      * @param cdt
700      * @return
701      */

702     private CoreDataStruct getDataCacheItem(String JavaDoc handle, CoreDataStruct cdt) {
703         if (!nonVisibleList.containsKey(handle)) {
704             cdt = (CoreDataStruct) cache.get(handle);
705         }
706         return cdt;
707     }
708
709     /**
710      * Shows content of this class.
711      * Can be used for debugging.
712      */

713     public void show() {
714         System.out.println("-------------------------------------------------");
715         System.out.println(" maxCacheSize : " + cache.getMaxEntries());
716         System.out.println(" cacheReadOnly : " + tableConf.isReadOnly());
717         System.out.println(" initialQueryCache : " + initialQueryCache);
718         System.out.println(" fullCaching : " + isFull());
719     }
720
721     /**
722      * Shows content of this class.
723      * Can be used for debugging.
724      */

725     public String JavaDoc toString() {
726         StringBuffer JavaDoc ret = new StringBuffer JavaDoc();
727
728         ret.append("\n DataStructCacheImpl: ");
729         ret.append("\n cacheReadOnly : " + tableConf.isReadOnly());
730         ret.append("\n initialQueryCache : " + initialQueryCache);
731         ret.append("\n fullCaching : " + isFull());
732         return ret.toString();
733     }
734
735     
736     /**
737      * @return
738      */

739     public int getInitialCacheFetchSize() {
740         return initialCacheFetchSize;
741     }
742
743     /**
744      * @return
745      */

746     public int getInitialDSCacheSize() {
747         return initialDSCacheSize;
748     }
749
750     /**
751      * @param i
752      */

753     public void setInitialCacheFetchSize(int i) {
754         initialCacheFetchSize = i;
755     }
756
757     /**
758      * @param i
759      */

760     public void setInitialDSCacheSize(int i) {
761         initialDSCacheSize = i;
762     }
763
764
765     /**
766      * Inner class that implements TableStatistics class for administrating
767      * table and cache.
768      */

769     class DataStructCacheImplStatistics extends TableStatistics {
770
771         /**
772          * Constructor().
773          */

774         public DataStructCacheImplStatistics() {
775             super();
776         }
777
778         /**
779          * Returns type of the statistics. In this case, this is CACHE_STATISTICS.
780          *
781          * @return Type of the statistics: CACHE_STATISTICS.
782          */

783         public int getStatisticsType() {
784             return CACHE_STATISTICS;
785         }
786
787         /**
788          * Returns query statistics for DO cache.
789          * Since there is only one cache - DO cache, always is returned DO query
790          * statistics, no metter what is the value of parameter type.
791          *
792          * @param type should be 0
793          * (org.enhydra.dods.cache.CacheConstants.DATA_CACHE),
794          * but, since there is only one cache - DO cache, always is returned DO
795          * query statistics, parameter is not used.
796          *
797          * @return DO cache query statistics.
798          */

799         public CacheStatistics getCacheStatistics(int type) {
800             switch (type) {
801             case CacheConstants.DATA_CACHE:
802                 return cache;
803
804             default:
805                 return null;
806             }
807         }
808     }
809 }
810
Popular Tags