Project

General

Profile

Revision 2339128f

ID2339128f7a0a08bae44cce8bc3a0ccc7e4be5995
Parent 7cdc874a
Child 20cfb7a6

Added by Andreas Kohlbecker almost 4 years ago

ref #2939 option to set the CacheManager directly, needed for the taxeditor

View differences:

cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/cache/CdmCacher.java
2 2

  
3 3
import java.util.UUID;
4 4

  
5
import org.apache.log4j.Logger;
5 6
import org.springframework.beans.factory.annotation.Autowired;
6 7

  
7 8
import eu.etaxonomy.cdm.model.ICdmUuidCacher;
......
24 25

  
25 26
public abstract class CdmCacher implements ICdmUuidCacher {
26 27

  
28
    public static final Logger logger = Logger.getLogger(CdmCacher.class);
29

  
27 30
    @Autowired
28 31
    public CacheManager cacheManager;
29 32

  
......
54 57
     *
55 58
     * @return
56 59
     */
57
//    public static CacheManager getDefaultCacheManager() {
58
//        // this ensures a singleton cache manager
59
//
60
//        return CacheManager.create();
61
//    }
60
    public void addCacheManager(CacheManager cacheManager) {
61

  
62
        if(this.cacheManager == null){
63
            this.cacheManager = cacheManager;
64
        } else {
65
            logger.error("There is already a CacheManager configured.");
66
        }
67
    }
62 68

  
63 69
    /**
64 70
     * Returns the default cache configuration.
......
91 97
        if(defaultCache == null) {
92 98
            // Create default cache
93 99
            cacheManager.addCache(DEFAULT_CACHE_NAME);
100
            defaultCache = cacheManager.getCache(DEFAULT_CACHE_NAME);
94 101
            //FIXME write test to check if default config as defined in EhCacheConfiguration is being used
95 102
        }
96 103
        return defaultCache;

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)