Affects: 5.3.8


In method triggerAfterTimeout, line 74: We test deferredResult's state inside the loop. Can we move it out?

public void triggerAfterTimeout(NativeWebRequest request, DeferredResult<?> deferredResult) throws Exception {
    for (DeferredResultProcessingInterceptor interceptor : this.interceptors) {

        // Can we move this test out of the loop? The invocation is timeout after all.
    if (deferredResult.isSetOrExpired()) {
        return;
    }
    if (!interceptor.handleTimeout(request, deferredResult)){
        break;
    }
    }
}

Comment From: lijinliangyihao

I‘m sorry, I am wrong. interceptor.handleTimeout(request, deferredResult) may set the result and stop the loop, if we move the test out, it's logic will be incorrect. I'll close the issue.