Clear expression caches on context shutdown

Issue: SPR-12691
This commit is contained in:
Stephane Nicoll 2015-02-10 14:47:15 +01:00
parent 37c04bd9c8
commit 6b3092c236
2 changed files with 11 additions and 0 deletions

View File

@ -288,6 +288,7 @@ public abstract class CacheAspectSupport extends AbstractCacheInvoker
*/
protected void clearMetadataCache() {
this.metadataCache.clear();
this.evaluator.clear();
}
protected Object execute(CacheOperationInvoker invoker, Object target, Method method, Object[] args) {

View File

@ -123,6 +123,16 @@ class ExpressionEvaluator extends CachedExpressionEvaluator {
return getExpression(this.unlessCache, methodKey, unlessExpression).getValue(evalContext, boolean.class);
}
/**
* Clear all caches.
*/
void clear() {
this.keyCache.clear();
this.conditionCache.clear();
this.unlessCache.clear();
this.targetMethodCache.clear();
}
private Method getTargetMethod(Class<?> targetClass, Method method) {
AnnotatedElementKey methodKey = new AnnotatedElementKey(method, targetClass);
Method targetMethod = this.targetMethodCache.get(methodKey);