671 |
|
|
672 |
|
/** |
673 |
|
* Returns a new CompletionStage that, when this stage completes |
674 |
< |
* exceptionally, is executed with this stage's exception as the |
675 |
< |
* argument to the supplied function. Otherwise, if this stage |
676 |
< |
* completes normally, then the returned stage also completes |
677 |
< |
* normally with the same value. |
674 |
> |
* either normally or exceptionally, is executed with this stage's |
675 |
> |
* result and exception as arguments to the supplied function. |
676 |
> |
* |
677 |
> |
* <p>When this stage is complete, the given function is invoked |
678 |
> |
* with the result (or {@code null} if none) and the exception (or |
679 |
> |
* {@code null} if none) of this stage as arguments, and the |
680 |
> |
* function's result is used to complete the returned stage. |
681 |
|
* |
682 |
|
* @param fn the function to use to compute the value of the |
683 |
< |
* returned CompletionStage if this CompletionStage completed |
684 |
< |
* exceptionally |
683 |
> |
* returned CompletionStage |
684 |
> |
* @param <U> the function's return type |
685 |
|
* @return the new CompletionStage |
686 |
|
*/ |
687 |
< |
public CompletionStage<T> exceptionally |
688 |
< |
(Function<Throwable, ? extends T> fn); |
687 |
> |
public <U> CompletionStage<U> handle |
688 |
> |
(BiFunction<? super T, Throwable, ? extends U> fn); |
689 |
> |
|
690 |
> |
/** |
691 |
> |
* Returns a new CompletionStage that, when this stage completes |
692 |
> |
* either normally or exceptionally, is executed using this stage's |
693 |
> |
* default asynchronous execution facility, with this stage's |
694 |
> |
* result and exception as arguments to the supplied function. |
695 |
> |
* |
696 |
> |
* <p>When this stage is complete, the given function is invoked |
697 |
> |
* with the result (or {@code null} if none) and the exception (or |
698 |
> |
* {@code null} if none) of this stage as arguments, and the |
699 |
> |
* function's result is used to complete the returned stage. |
700 |
> |
* |
701 |
> |
* @param fn the function to use to compute the value of the |
702 |
> |
* returned CompletionStage |
703 |
> |
* @param <U> the function's return type |
704 |
> |
* @return the new CompletionStage |
705 |
> |
*/ |
706 |
> |
public <U> CompletionStage<U> handleAsync |
707 |
> |
(BiFunction<? super T, Throwable, ? extends U> fn); |
708 |
> |
|
709 |
> |
/** |
710 |
> |
* Returns a new CompletionStage that, when this stage completes |
711 |
> |
* either normally or exceptionally, is executed using the |
712 |
> |
* supplied executor, with this stage's result and exception as |
713 |
> |
* arguments to the supplied function. |
714 |
> |
* |
715 |
> |
* <p>When this stage is complete, the given function is invoked |
716 |
> |
* with the result (or {@code null} if none) and the exception (or |
717 |
> |
* {@code null} if none) of this stage as arguments, and the |
718 |
> |
* function's result is used to complete the returned stage. |
719 |
> |
* |
720 |
> |
* @param fn the function to use to compute the value of the |
721 |
> |
* returned CompletionStage |
722 |
> |
* @param executor the executor to use for asynchronous execution |
723 |
> |
* @param <U> the function's return type |
724 |
> |
* @return the new CompletionStage |
725 |
> |
*/ |
726 |
> |
public <U> CompletionStage<U> handleAsync |
727 |
> |
(BiFunction<? super T, Throwable, ? extends U> fn, |
728 |
> |
Executor executor); |
729 |
|
|
730 |
|
/** |
731 |
|
* Returns a new CompletionStage with the same result or exception as |
808 |
|
|
809 |
|
/** |
810 |
|
* Returns a new CompletionStage that, when this stage completes |
811 |
< |
* either normally or exceptionally, is executed with this stage's |
812 |
< |
* result and exception as arguments to the supplied function. |
813 |
< |
* |
814 |
< |
* <p>When this stage is complete, the given function is invoked |
772 |
< |
* with the result (or {@code null} if none) and the exception (or |
773 |
< |
* {@code null} if none) of this stage as arguments, and the |
774 |
< |
* function's result is used to complete the returned stage. |
775 |
< |
* |
776 |
< |
* @param fn the function to use to compute the value of the |
777 |
< |
* returned CompletionStage |
778 |
< |
* @param <U> the function's return type |
779 |
< |
* @return the new CompletionStage |
780 |
< |
*/ |
781 |
< |
public <U> CompletionStage<U> handle |
782 |
< |
(BiFunction<? super T, Throwable, ? extends U> fn); |
783 |
< |
|
784 |
< |
/** |
785 |
< |
* Returns a new CompletionStage that, when this stage completes |
786 |
< |
* either normally or exceptionally, is executed using this stage's |
787 |
< |
* default asynchronous execution facility, with this stage's |
788 |
< |
* result and exception as arguments to the supplied function. |
789 |
< |
* |
790 |
< |
* <p>When this stage is complete, the given function is invoked |
791 |
< |
* with the result (or {@code null} if none) and the exception (or |
792 |
< |
* {@code null} if none) of this stage as arguments, and the |
793 |
< |
* function's result is used to complete the returned stage. |
794 |
< |
* |
795 |
< |
* @param fn the function to use to compute the value of the |
796 |
< |
* returned CompletionStage |
797 |
< |
* @param <U> the function's return type |
798 |
< |
* @return the new CompletionStage |
799 |
< |
*/ |
800 |
< |
public <U> CompletionStage<U> handleAsync |
801 |
< |
(BiFunction<? super T, Throwable, ? extends U> fn); |
802 |
< |
|
803 |
< |
/** |
804 |
< |
* Returns a new CompletionStage that, when this stage completes |
805 |
< |
* either normally or exceptionally, is executed using the |
806 |
< |
* supplied executor, with this stage's result and exception as |
807 |
< |
* arguments to the supplied function. |
808 |
< |
* |
809 |
< |
* <p>When this stage is complete, the given function is invoked |
810 |
< |
* with the result (or {@code null} if none) and the exception (or |
811 |
< |
* {@code null} if none) of this stage as arguments, and the |
812 |
< |
* function's result is used to complete the returned stage. |
811 |
> |
* exceptionally, is executed with this stage's exception as the |
812 |
> |
* argument to the supplied function. Otherwise, if this stage |
813 |
> |
* completes normally, then the returned stage also completes |
814 |
> |
* normally with the same value. |
815 |
|
* |
816 |
|
* @param fn the function to use to compute the value of the |
817 |
< |
* returned CompletionStage |
818 |
< |
* @param executor the executor to use for asynchronous execution |
817 |
< |
* @param <U> the function's return type |
817 |
> |
* returned CompletionStage if this CompletionStage completed |
818 |
> |
* exceptionally |
819 |
|
* @return the new CompletionStage |
820 |
|
*/ |
821 |
< |
public <U> CompletionStage<U> handleAsync |
822 |
< |
(BiFunction<? super T, Throwable, ? extends U> fn, |
822 |
< |
Executor executor); |
821 |
> |
public CompletionStage<T> exceptionally |
822 |
> |
(Function<Throwable, ? extends T> fn); |
823 |
|
|
824 |
|
/** |
825 |
|
* Returns a {@link CompletableFuture} maintaining the same |