1   /*
2    * CacheCleanerHolder.java
3    *
4    * Created on Jan 25, 2005 at 11:25:02 AM
5    */
6   package ca.uhn.cache.helper;
7   
8   import ca.uhn.cache.internal.ICacheCleaner;
9   
10  
11  /***
12   * Holder of a <code>ICacheCleaner</code> subclass instance.
13   * 
14   * Delegates all methods calls to the holded cache cleaner.
15   * 
16   * @author <a href="mailto:alexei.guevara@uhn.on.ca">Alexei Guevara</a>
17   * @version $Revision: 1.1 $ updated on $Date: 2005/01/25 22:02:15 $ by $Author: aguevara $
18   */
19  public class CacheCleanerHolder implements ICacheCleaner {
20  
21      private ICacheCleaner myHoldedCacheCleaner;
22      
23      /***
24       */
25      public CacheCleanerHolder() {
26      }
27  
28      /***
29       * {@inheritDoc}
30       */
31      public void evictStaleChunks() {
32          assert myHoldedCacheCleaner != null : "myHoldedCacheCleaner != null";
33          
34          myHoldedCacheCleaner.evictStaleChunks();
35      }
36  
37      /***
38       * {@inheritDoc}
39       */
40      public void evictUnusedChunks() {
41          assert myHoldedCacheCleaner != null : "myHoldedCacheCleaner != null";
42          
43          myHoldedCacheCleaner.evictUnusedChunks();
44      }
45  
46      /***
47       * {@inheritDoc}
48       */
49      public long getTargetSize() {
50          assert myHoldedCacheCleaner != null : "myHoldedCacheCleaner != null";
51          
52          return myHoldedCacheCleaner.getTargetSize();
53      }
54      
55      /***
56       * @return Returns the holdedCacheCleaner.
57       */
58      public ICacheCleaner getHoldedCacheCleaner() {
59          return myHoldedCacheCleaner;
60      }
61      /***
62       * @param theHoldedCacheCleaner The holdedCacheCleaner to set.
63       */
64      public void setHoldedCacheCleaner( ICacheCleaner theHoldedCacheCleaner ) {
65          myHoldedCacheCleaner = theHoldedCacheCleaner;
66      }
67  }