2222import com .mongodb .lang .Nullable ;
2323
2424import java .util .Optional ;
25- import java .util .function .BiFunction ;
2625import java .util .function .BiPredicate ;
26+ import java .util .function .BinaryOperator ;
2727import java .util .function .Supplier ;
2828
2929import static com .mongodb .assertions .Assertions .assertFalse ;
@@ -110,9 +110,9 @@ public RetryState() {
110110 * </ul>
111111 * The exception thrown represents the failed result of the associated retryable activity,
112112 * i.e., the caller must not do any more attempts.
113- * @see #advanceOrThrow(Throwable, BiFunction , BiPredicate)
113+ * @see #advanceOrThrow(Throwable, BinaryOperator , BiPredicate)
114114 */
115- void advanceOrThrow (final RuntimeException attemptException , final BiFunction < Throwable , Throwable , Throwable > exceptionTransformer ,
115+ void advanceOrThrow (final RuntimeException attemptException , final BinaryOperator < Throwable > exceptionTransformer ,
116116 final BiPredicate <RetryState , Throwable > retryPredicate ) throws RuntimeException {
117117 try {
118118 doAdvanceOrThrow (attemptException , exceptionTransformer , retryPredicate , true );
@@ -127,9 +127,9 @@ void advanceOrThrow(final RuntimeException attemptException, final BiFunction<Th
127127 * This method is intended to be used by code that generally handles all {@link Throwable} types explicitly,
128128 * which is usually asynchronous code.
129129 *
130- * @see #advanceOrThrow(RuntimeException, BiFunction , BiPredicate)
130+ * @see #advanceOrThrow(RuntimeException, BinaryOperator , BiPredicate)
131131 */
132- void advanceOrThrow (final Throwable attemptException , final BiFunction < Throwable , Throwable , Throwable > exceptionTransformer ,
132+ void advanceOrThrow (final Throwable attemptException , final BinaryOperator < Throwable > exceptionTransformer ,
133133 final BiPredicate <RetryState , Throwable > retryPredicate ) throws Throwable {
134134 doAdvanceOrThrow (attemptException , exceptionTransformer , retryPredicate , false );
135135 }
@@ -140,7 +140,7 @@ void advanceOrThrow(final Throwable attemptException, final BiFunction<Throwable
140140 * as {@link RetryState} does not have any source of {@link Exception}s.
141141 */
142142 private void doAdvanceOrThrow (final Throwable attemptException ,
143- final BiFunction < Throwable , Throwable , Throwable > exceptionTransformer ,
143+ final BinaryOperator < Throwable > exceptionTransformer ,
144144 final BiPredicate <RetryState , Throwable > retryPredicate ,
145145 final boolean onlyRuntimeExceptions ) throws Throwable {
146146 assertTrue (attempt () < attempts );
@@ -166,10 +166,10 @@ private void doAdvanceOrThrow(final Throwable attemptException,
166166 }
167167
168168 /**
169- * @param onlyRuntimeExceptions See {@link #doAdvanceOrThrow(Throwable, BiFunction , BiPredicate, boolean)}.
169+ * @param onlyRuntimeExceptions See {@link #doAdvanceOrThrow(Throwable, BinaryOperator , BiPredicate, boolean)}.
170170 */
171171 private static Throwable transformException (@ Nullable final Throwable previouslyChosenException , final Throwable attemptException ,
172- final boolean onlyRuntimeExceptions , final BiFunction < Throwable , Throwable , Throwable > exceptionTransformer ) {
172+ final boolean onlyRuntimeExceptions , final BinaryOperator < Throwable > exceptionTransformer ) {
173173 if (onlyRuntimeExceptions && previouslyChosenException != null ) {
174174 assertTrue (isRuntime (previouslyChosenException ));
175175 }
@@ -194,7 +194,7 @@ private static Throwable transformException(@Nullable final Throwable previously
194194
195195 /**
196196 * @param readOnlyRetryState Must not be mutated by this method.
197- * @param onlyRuntimeExceptions See {@link #doAdvanceOrThrow(Throwable, BiFunction , BiPredicate, boolean)}.
197+ * @param onlyRuntimeExceptions See {@link #doAdvanceOrThrow(Throwable, BinaryOperator , BiPredicate, boolean)}.
198198 */
199199 private boolean shouldRetry (final RetryState readOnlyRetryState , final Throwable attemptException , final Throwable newlyChosenException ,
200200 final boolean onlyRuntimeExceptions , final BiPredicate <RetryState , Throwable > retryPredicate ) {
@@ -227,7 +227,7 @@ private static boolean isRuntime(@Nullable final Throwable exception) {
227227 * by the caller to complete the ongoing attempt.
228228 * <p>
229229 * If this method is called from
230- * {@linkplain RetryingSyncSupplier#RetryingSyncSupplier(RetryState, BiFunction , BiPredicate, Supplier)
230+ * {@linkplain RetryingSyncSupplier#RetryingSyncSupplier(RetryState, BinaryOperator , BiPredicate, Supplier)
231231 * retry predicate / failed result transformer}, the behavior is unspecified.
232232 *
233233 * @param predicate {@code true} iff retrying needs to be broken.
@@ -265,7 +265,7 @@ public void breakAndThrowIfRetryAnd(final Supplier<Boolean> predicate) throws Ru
265265 * but instead of throwing an exception, it relays it to the {@code callback}.
266266 * <p>
267267 * If this method is called from
268- * {@linkplain RetryingAsyncCallbackSupplier#RetryingAsyncCallbackSupplier(RetryState, BiFunction , BiPredicate, com.mongodb.internal.async.function. AsyncCallbackSupplier)
268+ * {@linkplain RetryingAsyncCallbackSupplier#RetryingAsyncCallbackSupplier(RetryState, BinaryOperator , BiPredicate, AsyncCallbackSupplier)
269269 * retry predicate / failed result transformer}, the behavior is unspecified.
270270 *
271271 * @return {@code true} iff the {@code callback} was completed, which happens in the same situations in which
0 commit comments