1 package org.apache.ojb.broker.cache; 2 3 17 18 import org.apache.ojb.broker.PersistenceBroker; 19 import org.apache.ojb.broker.util.logging.Logger; 20 import org.apache.ojb.broker.util.logging.LoggerFactory; 21 22 31 32 public class ObjectCacheFactory 33 { 34 private Logger log = LoggerFactory.getLogger(ObjectCacheFactory.class); 35 36 private static ObjectCacheFactory singleton = new ObjectCacheFactory(); 37 38 41 public static ObjectCacheFactory getInstance() 42 { 43 return singleton; 44 } 45 46 private ObjectCacheFactory() 47 { 48 } 49 50 57 public MaterializationCache createObjectCache(PersistenceBroker broker) 58 { 59 CacheDistributor cache = null; 60 try 61 { 62 log.info("Start creating new ObjectCache instance"); 63 75 cache = new CacheDistributor(broker); 76 log.info("Instantiate new " + cache.getClass().getName() + " for PB instance " + broker); 77 } 78 catch(Exception e) 79 { 80 log.error("Error while initiation, please check your configuration" + 81 " files and the used implementation class", e); 82 } 83 log.info("New ObjectCache instance was created"); 84 return new MaterializationCache(cache); 85 } 86 } 87 | Popular Tags |