Browse Source

Honour ErrorHandler if `Cache.put` fails

This commit makes sure that the `ErrorHandler` is invoked if the cache
fails to put an element (be it in the main cache or the exception cache).

See gh-1292
Issue: SPR-15188
pull/1317/head
David Brimley 8 years ago committed by Stephane Nicoll
parent
commit
3476d10efa
  1. 4
      spring-context-support/src/main/java/org/springframework/cache/jcache/interceptor/CacheResultInterceptor.java

4
spring-context-support/src/main/java/org/springframework/cache/jcache/interceptor/CacheResultInterceptor.java vendored

@ -59,7 +59,7 @@ class CacheResultInterceptor extends AbstractKeyCacheInterceptor<CacheResultOper @@ -59,7 +59,7 @@ class CacheResultInterceptor extends AbstractKeyCacheInterceptor<CacheResultOper
try {
Object invocationResult = invoker.invoke();
cache.put(cacheKey, invocationResult);
doPut(cache, cacheKey, invocationResult);
return invocationResult;
}
catch (CacheOperationInvoker.ThrowableWrapper ex) {
@ -88,7 +88,7 @@ class CacheResultInterceptor extends AbstractKeyCacheInterceptor<CacheResultOper @@ -88,7 +88,7 @@ class CacheResultInterceptor extends AbstractKeyCacheInterceptor<CacheResultOper
return;
}
if (filter.match(ex.getClass())) {
exceptionCache.put(cacheKey, ex);
doPut(exceptionCache, cacheKey, ex);
}
}

Loading…
Cancel
Save