Project

General

Profile

« Previous | Next » 

Revision f4142aa7

Added by Cherian Mathew almost 9 years ago

cdmlib-ehcache : removed disk based cache manager since the hb config is now cached in memory
CdmApplicationRemoteController, CdmModelCacher, CdmRemoteCacheManager, CdmModelGetMethodCacherTest : running the hibernate config load in separate thread
CdmTransientEntityCacher, EntityCacherDebugResult, CdmStore, SessionsViewPart: refactoring
httpInvokerServiceClients.xml : removed lazy loading of beans

View differences:

eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/remoting/cache/CdmModelCacher.java
21 21

  
22 22
	private static final Logger logger = Logger.getLogger(CdmModelCacher.class);
23 23

  
24
	public static String HB_CONFIG_FILE_PATH= "/eu/etaxonomy/cdm/mappings/hibernate.cfg.xml";
25

  
24 26
	private final List<CdmModelFieldPropertyFromClass> cmgmfcList = new ArrayList<CdmModelFieldPropertyFromClass>();
25 27

  
26 28

  
27
	public void cacheGetterFields() {
29
	public static Configuration buildConfiguration() {
30
	    Configuration configuration = new Configuration().configure(HB_CONFIG_FILE_PATH);
31
        configuration.buildMappings();
32
        return configuration;
33
	}
34

  
35
	public void cacheGetterFields(Cache cache) {
28 36

  
29
		Configuration configuration = new Configuration().configure("/eu/etaxonomy/cdm/mappings/hibernate.cfg.xml");
30
		configuration.buildMappings();
37
	    Configuration configuration = buildConfiguration();
31 38
		Iterator<PersistentClass> classMappingIterator =   configuration.getClassMappings();
32 39

  
33
		Cache cache = CdmRemoteCacheManager.getInstance().getCdmModelGetMethodsCache();
34 40
		cache.removeAll();
35 41

  
36 42
		while(classMappingIterator.hasNext()) {
......
42 48
			logger.info("Adding class : " + mappedClassName + " to cache");
43 49
			addGetters(persistentClass, cmgmfc);
44 50
			cache.put(new Element(mappedClassName, cmgmfc));
45

  
46 51
		}
47
		//cache.flush();
52

  
48 53
	}
49 54

  
50 55
	private void addGetters(PersistentClass persistentClass, CdmModelFieldPropertyFromClass cmgmfc) {
......
68 73

  
69 74
	public void checkGetterMethods() {
70 75

  
71
		Configuration configuration = new Configuration().configure("/eu/etaxonomy/cdm/mappings/hibernate.cfg.xml");
76
		Configuration configuration = new Configuration().configure(HB_CONFIG_FILE_PATH);
72 77
		configuration.buildMappings();
73 78
		Iterator<PersistentClass> classMappingIterator =   configuration.getClassMappings();
74 79

  
......
113 118

  
114 119
	public List<CdmModelFieldPropertyFromClass> getCdmModelGetMethodFromClassList() {
115 120
		cmgmfcList.clear();
116
		Configuration configuration = new Configuration().configure("/eu/etaxonomy/cdm/mappings/hibernate.cfg.xml");
121
		Configuration configuration = new Configuration().configure(HB_CONFIG_FILE_PATH);
117 122
		configuration.buildMappings();
118 123
		Iterator<PersistentClass> classMappingIterator =   configuration.getClassMappings();
119 124

  

Also available in: Unified diff