Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,9 @@ public static <T> SubscribableListener<T> newFailed(Exception exception) {
/**
* Create a {@link SubscribableListener}, fork a computation to complete it, and return the listener. If the forking itself throws an
* exception then the exception is caught and fed to the returned listener.
* <p>
* The listener passed to {@code fork} is the returned {@link SubscribableListener}. In particular, it is valid to complete this
* listener more than once, but all results after the first completion will be silently ignored.
*/
public static <T> SubscribableListener<T> newForked(CheckedConsumer<ActionListener<T>, ? extends Exception> fork) {
final var listener = new SubscribableListener<T>();
Expand Down Expand Up @@ -448,6 +451,9 @@ public void complete(ActionListener<?> listener) {
* <li>Ensure that this {@link SubscribableListener} is always completed using that executor, and</li>
* <li>Invoke {@link #andThen} using that executor.</li>
* </ul>
* <p>
* The listener passed to {@code nextStep} is the returned {@link SubscribableListener}. In particular, it is valid to complete this
* listener more than once, but all results after the first completion will be silently ignored.
*/
public <U> SubscribableListener<U> andThen(CheckedConsumer<ActionListener<U>, ? extends Exception> nextStep) {
return newForked(l -> addListener(l.delegateFailureIgnoreResponseAndWrap(nextStep)));
Expand Down Expand Up @@ -475,6 +481,9 @@ public <U> SubscribableListener<U> andThen(CheckedConsumer<ActionListener<U>, ?
* <li>Ensure that this {@link SubscribableListener} is always completed using that executor, and</li>
* <li>Invoke {@link #andThen} using that executor.</li>
* </ul>
* <p>
* The listener passed to {@code nextStep} is the returned {@link SubscribableListener}. In particular, it is valid to complete this
* listener more than once, but all results after the first completion will be silently ignored.
*/
public <U> SubscribableListener<U> andThen(CheckedBiConsumer<ActionListener<U>, T, ? extends Exception> nextStep) {
return andThen(EsExecutors.DIRECT_EXECUTOR_SERVICE, null, nextStep);
Expand Down Expand Up @@ -513,6 +522,9 @@ public <U> SubscribableListener<U> andThen(CheckedBiConsumer<ActionListener<U>,
* with a rejection exception on the thread which completes this listener. Likewise if this listener is completed exceptionally but
* {@code executor} rejects the execution of the completion of the returned listener then the returned listener is completed with a
* rejection exception on the thread which completes this listener.
* <p>
* The listener passed to {@code nextStep} is the returned {@link SubscribableListener}. In particular, it is valid to complete this
* listener more than once, but all results after the first completion will be silently ignored.
*/
public <U> SubscribableListener<U> andThen(
Executor executor,
Expand Down