public CacheResultOperation(CacheMethodDetails<CacheResult> methodDetails, CacheResolver cacheResolver, KeyGenerator keyGenerator, @Nullable CacheResolver exceptionCacheResolver) { super(methodDetails, cacheResolver, keyGenerator); CacheResult ann = methodDetails.getCacheAnnotation(); this.exceptionTypeFilter = createExceptionTypeFilter(ann.cachedExceptions(), ann.nonCachedExceptions()); this.exceptionCacheResolver = exceptionCacheResolver; this.exceptionCacheName = (StringUtils.hasText(ann.exceptionCacheName()) ? ann.exceptionCacheName() : null); }
public CacheResultOperation(CacheMethodDetails<CacheResult> methodDetails, CacheResolver cacheResolver, KeyGenerator keyGenerator, @Nullable CacheResolver exceptionCacheResolver) { super(methodDetails, cacheResolver, keyGenerator); CacheResult ann = methodDetails.getCacheAnnotation(); this.exceptionTypeFilter = createExceptionTypeFilter(ann.cachedExceptions(), ann.nonCachedExceptions()); this.exceptionCacheResolver = exceptionCacheResolver; this.exceptionCacheName = (StringUtils.hasText(ann.exceptionCacheName()) ? ann.exceptionCacheName() : null); }
public CacheResultOperation(CacheMethodDetails<CacheResult> methodDetails, CacheResolver cacheResolver, KeyGenerator keyGenerator, CacheResolver exceptionCacheResolver) { super(methodDetails, cacheResolver, keyGenerator); CacheResult ann = methodDetails.getCacheAnnotation(); this.exceptionTypeFilter = createExceptionTypeFilter(ann.cachedExceptions(), ann.nonCachedExceptions()); this.exceptionCacheResolver = exceptionCacheResolver; this.exceptionCacheName = (StringUtils.hasText(ann.exceptionCacheName()) ? ann.exceptionCacheName() : null); }
/** * Cache the exception if exception caching is enabled. * * @param exceptionCache The exception cache, may be null if no exception caching is being done * @param cacheKey The cache key * @param cacheResultAnnotation The cache result annotation * @param t The exception to cache */ protected void cacheException(final Cache<Object, Throwable> exceptionCache, final GeneratedCacheKey cacheKey, final CacheResult cacheResultAnnotation, Throwable t) { if (exceptionCache == null) { return; } final Class<? extends Throwable>[] cachedExceptions = cacheResultAnnotation.cachedExceptions(); final Class<? extends Throwable>[] nonCachedExceptions = cacheResultAnnotation.nonCachedExceptions(); final boolean included = ClassFilter.isIncluded(t, cachedExceptions, nonCachedExceptions, true); if (included) { //Cache the exception for future rethrow exceptionCache.put(cacheKey, t); } }
if (helper.isIncluded(t.getClass(), cacheResult.cachedExceptions(), cacheResult.nonCachedExceptions())) { if (exceptionCache == null) { exceptionCache = cacheResolverFactory.getExceptionCacheResolver(context).resolveCache(context);
if (helper.isIncluded(t.getClass(), cacheResult.cachedExceptions(), cacheResult.nonCachedExceptions()))
if (helper.isIncluded(t.getClass(), cacheResult.cachedExceptions(), cacheResult.nonCachedExceptions()))