Fix deadlock issue in DeferredResult

Previously DeferredResult locked around the setting of the result
including handling up to the part of submitting a dispatch. This
can cause a deadlock if a timeout occurs at the same time since
the Tomcat timeout thread has its own locking that permits only
one thread to do timeout or dispatch processing.

The fix reduces the locking to cover only the attempt to set the
DeferredResult but not the dispatching.

Issue: SPR-10485
master
Rossen Stoyanchev 12 years ago
parent 6825aaf41f
commit db596d23de
  1. 6
      spring-web/src/main/java/org/springframework/web/context/request/async/DeferredResult.java

@ -173,9 +173,9 @@ public class DeferredResult<T> {
return false; return false;
} }
this.result = result; this.result = result;
if (this.resultHandler != null) { }
this.resultHandler.handleResult(this.result); if (this.resultHandler != null) {
} this.resultHandler.handleResult(this.result);
} }
return true; return true;
} }

Loading…
Cancel
Save