EhCache/JCacheCacheManager needs to re-obtain runtime-added Cache reference for potential decoration

Issue: SPR-11407
(cherry picked from commit ef1748f)
This commit is contained in:
Juergen Hoeller
2014-02-14 21:58:48 +01:00
parent 27ad1990e3
commit 42dec02203
2 changed files with 7 additions and 7 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -46,7 +46,7 @@ public class EhCacheCacheManager extends AbstractTransactionSupportingCacheManag
}
/**
* Create a new EhCacheCacheManager for the given backing EhCache.
* Create a new EhCacheCacheManager for the given backing EhCache CacheManager.
* @param cacheManager the backing EhCache {@link net.sf.ehcache.CacheManager}
*/
public EhCacheCacheManager(net.sf.ehcache.CacheManager cacheManager) {
@@ -92,8 +92,8 @@ public class EhCacheCacheManager extends AbstractTransactionSupportingCacheManag
// (in case the cache was added at runtime)
Ehcache ehcache = this.cacheManager.getEhcache(name);
if (ehcache != null) {
cache = new EhCacheCache(ehcache);
addCache(cache);
addCache(new EhCacheCache(ehcache));
cache = super.getCache(name); // potentially decorated
}
}
return cache;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -110,8 +110,8 @@ public class JCacheCacheManager extends AbstractTransactionSupportingCacheManage
// (in case the cache was added at runtime)
javax.cache.Cache<?,?> jcache = this.cacheManager.getCache(name);
if (jcache != null) {
cache = new JCacheCache(jcache, this.allowNullValues);
addCache(cache);
addCache(new JCacheCache(jcache, this.allowNullValues));
cache = super.getCache(name); // potentially decorated
}
}
return cache;