@@ -89,19 +89,21 @@ default ActionListener<Response> delegateResponse(BiConsumer<ActionListener<Resp
8989 }
9090
9191 /**
92- * Creates a listener that delegates all exceptions it receives to another listener.
92+ * Creates a new listener, wrapping this one, that overrides {@link #onResponse} handling with the given {@code bc} consumer.
93+ * {@link #onFailure(Exception)} handling is delegated to the original listener. Exceptions in {@link #onResponse} are forbidden.
9394 *
94- * @param bc BiConsumer invoked with delegate listener and response
95+ * @param bc {@link BiConsumer} invoked via {@link #onResponse} with the original listener and the response with which the new listener
96+ * was completed.
9597 * @param <T> Type of the delegating listener's response
96- * @return Delegating listener
98+ * @return a new listener that delegates failures to this listener and runs {@code bc} on a response.
9799 */
98100 default <T > ActionListener <T > delegateFailure (BiConsumer <ActionListener <Response >, T > bc ) {
99101 return new ActionListenerImplementations .DelegatingFailureActionListener <>(this , bc );
100102 }
101103
102104 /**
103- * Same as {@link #delegateFailure(BiConsumer)} except that any failure thrown by {@code bc} or the delegate listener's
104- * {@link #onResponse} will be passed to the delegate listeners {@link #onFailure(Exception)}.
105+ * Same as {@link #delegateFailure(BiConsumer)} except that any failure thrown by {@code bc} or the original listener's
106+ * {@link #onResponse} will be passed to the original listener's {@link #onFailure(Exception)}.
105107 */
106108 default <T > ActionListener <T > delegateFailureAndWrap (CheckedBiConsumer <ActionListener <Response >, T , ? extends Exception > bc ) {
107109 return new ActionListenerImplementations .ResponseWrappingActionListener <>(this , bc );
@@ -150,7 +152,7 @@ public String toString() {
150152 * the sense that an exception from the {@code onResponse} consumer is passed into the {@code onFailure} consumer.
151153 * <p>
152154 * If the {@code onFailure} argument is {@code listener::onFailure} for some other {@link ActionListener}, prefer to use
153- * {@link #delegateFailureAndWrap} instead.
155+ * {@link #delegateFailureAndWrap} instead for performance reasons .
154156 * @param onResponse the checked consumer of the response, executed when the listener is completed successfully. If it throws an
155157 * exception, the exception is passed to the {@code onFailure} consumer.
156158 * @param onFailure the consumer of the failure, executed when the listener is completed with an exception (or it is completed
0 commit comments