提交 9ba4b47b 编写于 作者: J Juergen Hoeller

Defensive processing of timeout callback and timeout result

Issue: SPR-14978
上级 9376748c
......@@ -253,13 +253,24 @@ public class DeferredResult<T> {
return new DeferredResultProcessingInterceptorAdapter() {
@Override
public <S> boolean handleTimeout(NativeWebRequest request, DeferredResult<S> deferredResult) {
if (timeoutCallback != null) {
timeoutCallback.run();
boolean continueProcessing = true;
try {
if (timeoutCallback != null) {
timeoutCallback.run();
}
}
if (timeoutResult != RESULT_NONE) {
setResultInternal(timeoutResult);
finally {
if (timeoutResult != RESULT_NONE) {
continueProcessing = false;
try {
setResultInternal(timeoutResult);
}
catch (Throwable ex) {
logger.debug("Failed to handle timeout result", ex);
}
}
}
return true;
return continueProcessing;
}
@Override
public <S> void afterCompletion(NativeWebRequest request, DeferredResult<S> deferredResult) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册