class CacheResultInterceptor extends AbstractKeyCacheInterceptor<CacheResultOperation,CacheResult>
CacheResult
.logger
Constructor and Description |
---|
CacheResultInterceptor(CacheErrorHandler errorHandler) |
Modifier and Type | Method and Description |
---|---|
protected void |
cacheException(Cache exceptionCache,
ExceptionTypeFilter filter,
java.lang.Object cacheKey,
java.lang.Throwable ex) |
protected void |
checkForCachedException(Cache exceptionCache,
java.lang.Object cacheKey)
Check for a cached exception.
|
private static <T extends java.lang.Throwable> |
cloneException(T exception) |
private static int |
findCommonAncestorIndex(java.lang.StackTraceElement[] callStack,
java.lang.String className,
java.lang.String methodName) |
protected java.lang.Object |
invoke(CacheOperationInvocationContext<CacheResultOperation> context,
CacheOperationInvoker invoker) |
private Cache |
resolveExceptionCache(CacheOperationInvocationContext<CacheResultOperation> context) |
private static CacheOperationInvoker.ThrowableWrapper |
rewriteCallStack(java.lang.Throwable exception,
java.lang.String className,
java.lang.String methodName)
Rewrite the call stack of the specified
exception so that it matches
the current call stack up to (included) the specified method invocation. |
createCacheKeyInvocationContext, generateKey
extractFrom, resolveCache
doClear, doEvict, doGet, doPut, getErrorHandler, setErrorHandler
public CacheResultInterceptor(CacheErrorHandler errorHandler)
protected java.lang.Object invoke(CacheOperationInvocationContext<CacheResultOperation> context, CacheOperationInvoker invoker)
invoke
in class AbstractCacheInterceptor<CacheResultOperation,CacheResult>
protected void checkForCachedException(Cache exceptionCache, java.lang.Object cacheKey)
protected void cacheException(Cache exceptionCache, ExceptionTypeFilter filter, java.lang.Object cacheKey, java.lang.Throwable ex)
private Cache resolveExceptionCache(CacheOperationInvocationContext<CacheResultOperation> context)
private static CacheOperationInvoker.ThrowableWrapper rewriteCallStack(java.lang.Throwable exception, java.lang.String className, java.lang.String methodName)
exception
so that it matches
the current call stack up to (included) the specified method invocation.
Clone the specified exception. If the exception is not serializable
,
the original exception is returned. If no common ancestor can be found, returns
the original exception.
Used to make sure that a cached exception has a valid invocation context.
exception
- the exception to merge with the current call stackclassName
- the class name of the common ancestormethodName
- the method name of the common ancestorclassName
and
methodName
arguments, followed by stack trace elements of the specified
exception
after the common ancestor.private static <T extends java.lang.Throwable> T cloneException(T exception)
private static int findCommonAncestorIndex(java.lang.StackTraceElement[] callStack, java.lang.String className, java.lang.String methodName)