1 package org.shiftone.cache.decorator.stat; 2 3 4 5 import org.shiftone.cache.Cache; 6 import org.shiftone.cache.util.AbstractDecoratorCacheFactory; 7 8 9 13 public class StatCacheFactory extends AbstractDecoratorCacheFactory 14 { 15 16 private ShutdownHook shutdownHook = null; 17 18 private synchronized ShutdownHook getShutdownHook() 19 { 20 21 if (shutdownHook == null) 22 { 23 shutdownHook = new ShutdownHook(); 24 25 shutdownHook.setTitle(getDelegate().toString()); 26 } 27 28 return shutdownHook; 29 } 30 31 32 protected Cache wrapDelegate(String cacheName, Cache delegateCache) 33 { 34 35 StatCache statCache = new StatCache(cacheName, delegateCache); 36 37 getShutdownHook().addStatCache(statCache); 38 39 return statCache; 40 } 41 42 43 public void setMaxCaches(int maxCaches) 44 { 45 shutdownHook.setMaxCaches(maxCaches); 46 } 47 48 49 public String toString() 50 { 51 return "StatCacheFactory->" + getDelegate(); 52 } 53 } 54 | Popular Tags |