This commit is contained in:
Rossen Stoyanchev 2017-06-01 09:28:55 -04:00
parent e8d2c6c74b
commit b93579a43e
3 changed files with 14 additions and 12 deletions

View File

@ -163,11 +163,11 @@ public abstract class AbstractListenerWriteProcessor<T> implements Processor<T,
}
/**
* Invoked when an error happens while writing. Defaults to no-op.
* Servlet 3.1 based implementations will receive
* {@link WriteListener#onError(Throwable)} event.
* Invoked when an error happens while writing.
* <p>Defaults to no-op. Servlet 3.1 based implementations will receive
* {@code javax.servlet.WriteListener#onError(Throwable)} event.
*/
protected void writingFailed(Throwable t) {
protected void writingFailed(Throwable ex) {
}

View File

@ -192,9 +192,10 @@ public class ServletServerHttpResponse extends AbstractListenerServerHttpRespons
}
void handleError(Throwable ex) {
if (bodyFlushProcessor != null) {
bodyFlushProcessor.cancel();
bodyFlushProcessor.onError(ex);
ResponseBodyFlushProcessor flushProcessor = bodyFlushProcessor;
if (flushProcessor != null) {
flushProcessor.cancel();
flushProcessor.onError(ex);
}
ResponseBodyProcessor processor = bodyProcessor;
@ -206,9 +207,10 @@ public class ServletServerHttpResponse extends AbstractListenerServerHttpRespons
@Override
public void onComplete(AsyncEvent event) {
if (bodyFlushProcessor != null) {
bodyFlushProcessor.cancel();
bodyFlushProcessor.onComplete();
ResponseBodyFlushProcessor flushProcessor = bodyFlushProcessor;
if (flushProcessor != null) {
flushProcessor.cancel();
flushProcessor.onComplete();
}
ResponseBodyProcessor processor = bodyProcessor;

View File

@ -231,9 +231,9 @@ public class UndertowServerHttpResponse extends AbstractListenerServerHttpRespon
}
@Override
protected void writingFailed(Throwable t) {
protected void writingFailed(Throwable ex) {
cancel();
onError(t);
onError(ex);
}
}