Fix issue in Callable processing interceptor chain
This commit is contained in:
@@ -49,15 +49,22 @@ class CallableInterceptorChain {
|
||||
}
|
||||
|
||||
public Object applyPostProcess(NativeWebRequest request, Callable<?> task, Object concurrentResult) {
|
||||
Throwable exceptionResult = null;
|
||||
for (int i = this.preProcessIndex; i >= 0; i--) {
|
||||
try {
|
||||
this.interceptors.get(i).postProcess(request, task, concurrentResult);
|
||||
}
|
||||
catch (Throwable t) {
|
||||
return t;
|
||||
// Save the first exception but invoke all interceptors
|
||||
if (exceptionResult != null) {
|
||||
logger.error("postProcess error", t);
|
||||
}
|
||||
else {
|
||||
exceptionResult = t;
|
||||
}
|
||||
}
|
||||
}
|
||||
return concurrentResult;
|
||||
return (exceptionResult != null) ? exceptionResult : concurrentResult;
|
||||
}
|
||||
|
||||
public Object triggerAfterTimeout(NativeWebRequest request, Callable<?> task) {
|
||||
|
||||
@@ -197,7 +197,7 @@ public final class WebAsyncManager {
|
||||
* The key is derived from the class name and hashcode.
|
||||
* @param interceptor the interceptor to register
|
||||
*/
|
||||
public void registerCallableInterceptor(CallableProcessingInterceptor... interceptors) {
|
||||
public void registerCallableInterceptors(CallableProcessingInterceptor... interceptors) {
|
||||
Assert.notNull(interceptors, "A CallableProcessingInterceptor is required");
|
||||
for (CallableProcessingInterceptor interceptor : interceptors) {
|
||||
String key = interceptor.getClass().getName() + ":" + interceptor.hashCode();
|
||||
@@ -222,7 +222,7 @@ public final class WebAsyncManager {
|
||||
* @param key the key
|
||||
* @param interceptors the interceptor to register
|
||||
*/
|
||||
public void registerDeferredResultInterceptor(DeferredResultProcessingInterceptor... interceptors) {
|
||||
public void registerDeferredResultInterceptors(DeferredResultProcessingInterceptor... interceptors) {
|
||||
Assert.notNull(interceptors, "A DeferredResultProcessingInterceptor is required");
|
||||
for (DeferredResultProcessingInterceptor interceptor : interceptors) {
|
||||
String key = interceptors.getClass().getName() + ":" + interceptors.hashCode();
|
||||
|
||||
Reference in New Issue
Block a user