diff --git a/api/src/main/java/jakarta/servlet/WriteListener.java b/api/src/main/java/jakarta/servlet/WriteListener.java index 91d768a2e..e6cac457c 100644 --- a/api/src/main/java/jakarta/servlet/WriteListener.java +++ b/api/src/main/java/jakarta/servlet/WriteListener.java @@ -40,19 +40,24 @@ public interface WriteListener extends EventListener { void onWritePossible() throws IOException; /** - * Invoked when an error occurs writing data using the non-blocking APIs. This listener will be invoked if there is a - * problem with the underlying connection while data is being written to the stream. We consider data to be being - * written when any of the following conditions are met: - * + * Invoked when an error occurs writing data after + * {@link ServletOutputStream#setWriteListener(WriteListener)} has been called. + * This method will be invoked if there is a problem while data is being written to the + * stream and either: * * - * If these conditions are not met and the stream is still open then any failure notification will not be delivered - * until {@link ServletOutputStream#isReady()} is invoked. {@code isReady} must return false in this situation, and then - * the failure will be delivered to the {@link #onError(Throwable)} method. + * If these conditions are not met and the stream is still open then any failure + * notification will be delivered either: + * by an exception thrown from a {@code IO} operation after an invocation of + * {@link ServletOutputStream#isReady()} has returned {@code true}; or by a call to this method + * after an invocation of {@link ServletOutputStream#isReady()} has returned {@code false}; + *

+ * This method will not be invoked in any circumstances after + * {@link AsyncListener#onComplete(AsyncEvent)} has been called. * * @param t the throwable to indicate why the write operation failed */