Skip to content

Commit 9797692

Browse files
Apply suggestions from code review
Co-authored-by: Greg Wilkins <[email protected]>
1 parent 50f278b commit 9797692

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

api/src/main/java/jakarta/servlet/WriteListener.java

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,19 +40,24 @@ public interface WriteListener extends EventListener {
4040
void onWritePossible() throws IOException;
4141

4242
/**
43-
* Invoked when an error occurs writing data using the non-blocking APIs. This listener will be invoked if there is a
44-
* problem with the underlying connection while data is being written to the stream. We consider data to be being
45-
* written when any of the following conditions are met:
46-
*
43+
* Invoked when an error occurs writing data after
44+
* {@link ServletOutputStream#setWriteListener(WriteListener)} has been called.
45+
* This method will be invoked if there is a problem while data is being written to the
46+
* stream and either:
4747
* <ul>
4848
* <li>{@link ServletOutputStream#isReady()} has been invoked and returned false</li>
49-
* <li>{@link ServletOutputStream#close()} has been called, and the failure occurred before the response could be fully
50-
* written to the client</li>
49+
* <li>{@link ServletOutputStream#close()} has been called, and the failure occurred before
50+
* the response could be fully written to the client</li>
5151
* </ul>
5252
*
53-
* If these conditions are not met and the stream is still open then any failure notification will not be delivered
54-
* until {@link ServletOutputStream#isReady()} is invoked. {@code isReady} must return false in this situation, and then
55-
* the failure will be delivered to the {@link #onError(Throwable)} method.
53+
* If these conditions are not met and the stream is still open then any failure
54+
* notification will be delivered either:
55+
* by an exception thrown from a {@code IO} operation after an invocation of
56+
* {@link ServletOutputStream#isReady()} has returned {@code true}; or by a call to this method
57+
* after an invocation of {@link ServletOutputStream#isReady()} has returned {@code false};
58+
* <p>
59+
* This method will not be invoked in any circumstances after
60+
* {@link AsyncListener#onComplete(AsyncEvent)} has been called.
5661
*
5762
* @param t the throwable to indicate why the write operation failed
5863
*/

0 commit comments

Comments
 (0)