List of usage examples for org.springframework.cache.interceptor CacheOperationInvoker invoke
Object invoke() throws ThrowableWrapper;
From source file:org.springframework.cache.interceptor.CacheAspectSupport.java
@Nullable protected Object execute(CacheOperationInvoker invoker, Object target, Method method, Object[] args) { // Check whether aspect is enabled (to cope with cases where the AJ is pulled in automatically) if (this.initialized) { Class<?> targetClass = getTargetClass(target); CacheOperationSource cacheOperationSource = getCacheOperationSource(); if (cacheOperationSource != null) { Collection<CacheOperation> operations = cacheOperationSource.getCacheOperations(method, targetClass);/*from w w w . j a v a 2s . com*/ if (!CollectionUtils.isEmpty(operations)) { return execute(invoker, method, new CacheOperationContexts(operations, method, args, target, targetClass)); } } } return invoker.invoke(); }
From source file:org.springframework.cache.interceptor.CacheAspectSupport.java
/** * Execute the underlying operation (typically in case of cache miss) and return * the result of the invocation. If an exception occurs it will be wrapped in * a {@link CacheOperationInvoker.ThrowableWrapper}: the exception can be handled * or modified but it <em>must</em> be wrapped in a * {@link CacheOperationInvoker.ThrowableWrapper} as well. * @param invoker the invoker handling the operation being cached * @return the result of the invocation/*from ww w. j a v a2 s.c o m*/ * @see CacheOperationInvoker#invoke() */ protected Object invokeOperation(CacheOperationInvoker invoker) { return invoker.invoke(); }
From source file:org.springframework.cache.jcache.interceptor.JCacheAspectSupport.java
protected Object execute(CacheOperationInvoker invoker, Object target, Method method, Object[] args) { // Check whether aspect is enabled to cope with cases where the AJ is pulled in automatically if (this.initialized) { Class<?> targetClass = AopProxyUtils.ultimateTargetClass(target); JCacheOperation<?> operation = getCacheOperationSource().getCacheOperation(method, targetClass); if (operation != null) { CacheOperationInvocationContext<?> context = createCacheOperationInvocationContext(target, args, operation);//from w w w . j ava 2 s . co m return execute(context, invoker); } } return invoker.invoke(); }