Synchronized cache creation on CacheManager
Issue: SPR-11132
(cherry picked from commit de890fd)
This commit is contained in:
parent
c1b772cd9c
commit
1dc79f7f9c
|
|
@ -316,10 +316,11 @@ public class EhCacheFactoryBean implements FactoryBean<Ehcache>, BeanNameAware,
|
|||
this.cacheName = this.beanName;
|
||||
}
|
||||
|
||||
synchronized (this.cacheManager) {
|
||||
// Fetch cache region: If none with the given name exists,
|
||||
// create one on the fly.
|
||||
Ehcache rawCache;
|
||||
boolean cacheExists = this.cacheManager.cacheExists(cacheName);
|
||||
boolean cacheExists = this.cacheManager.cacheExists(this.cacheName);
|
||||
if (cacheExists) {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Using existing EhCache cache region '" + this.cacheName + "'");
|
||||
|
|
@ -357,6 +358,7 @@ public class EhCacheFactoryBean implements FactoryBean<Ehcache>, BeanNameAware,
|
|||
}
|
||||
this.cache = decoratedCache;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a raw Cache object based on the configuration of this FactoryBean.
|
||||
|
|
|
|||
Loading…
Reference in New Issue