Skip to content

Commit e4ffab4

Browse files
committed
Replace BiFunction with BinaryOperator
JAVA-4254
1 parent da6d111 commit e4ffab4

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

driver-core/src/main/com/mongodb/internal/operation/AsyncOperationHelper.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444

4545
import java.util.Collections;
4646
import java.util.List;
47-
import java.util.function.BiFunction;
47+
import java.util.function.BinaryOperator;
4848

4949
import static com.mongodb.assertions.Assertions.assertNotNull;
5050
import static com.mongodb.internal.async.ErrorHandlingResultCallback.errorHandlingCallback;
@@ -286,7 +286,7 @@ static <D, T> void createReadCommandAndExecuteAsync(
286286

287287
static <R> AsyncCallbackSupplier<R> decorateReadWithRetriesAsync(final RetryState retryState, final OperationContext operationContext,
288288
final AsyncCallbackSupplier<R> asyncReadFunction) {
289-
BiFunction<Throwable, Throwable, Throwable> onAttemptFailure =
289+
BinaryOperator<Throwable> onAttemptFailure =
290290
(@Nullable Throwable previouslyChosenException, Throwable mostRecentAttemptException) ->
291291
CommandOperationHelper.onRetryableReadAttemptFailure(
292292
operationContext, previouslyChosenException, mostRecentAttemptException);
@@ -299,7 +299,7 @@ static <R> AsyncCallbackSupplier<R> decorateReadWithRetriesAsync(final RetryStat
299299

300300
static <R> AsyncCallbackSupplier<R> decorateWriteWithRetriesAsync(final RetryState retryState, final OperationContext operationContext,
301301
final AsyncCallbackSupplier<R> asyncWriteFunction) {
302-
BiFunction<Throwable, Throwable, Throwable> onAttemptFailure =
302+
BinaryOperator<Throwable> onAttemptFailure =
303303
(@Nullable Throwable previouslyChosenException, Throwable mostRecentAttemptException) ->
304304
CommandOperationHelper.onRetryableWriteAttemptFailure(
305305
operationContext, previouslyChosenException, mostRecentAttemptException);

driver-core/src/main/com/mongodb/internal/operation/MixedBulkWriteOperation.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
import java.util.List;
5252
import java.util.Optional;
5353
import java.util.Set;
54-
import java.util.function.BiFunction;
54+
import java.util.function.BinaryOperator;
5555
import java.util.function.Supplier;
5656
import java.util.stream.Collectors;
5757

@@ -141,7 +141,7 @@ public Boolean getRetryWrites() {
141141

142142
private <R> Supplier<R> decorateWriteWithRetries(final RetryState retryState, final OperationContext operationContext,
143143
final Supplier<R> writeFunction) {
144-
BiFunction<Throwable, Throwable, Throwable> onAttemptFailure =
144+
BinaryOperator<Throwable> onAttemptFailure =
145145
(@Nullable Throwable previouslyChosenException, Throwable mostRecentAttemptException) ->
146146
CommandOperationHelper.onRetryableWriteAttemptFailure(
147147
operationContext, previouslyChosenException, mostRecentAttemptException);
@@ -154,7 +154,7 @@ private <R> Supplier<R> decorateWriteWithRetries(final RetryState retryState, fi
154154

155155
private <R> AsyncCallbackSupplier<R> decorateWriteWithRetries(final RetryState retryState, final OperationContext operationContext,
156156
final AsyncCallbackSupplier<R> writeFunction) {
157-
BiFunction<Throwable, Throwable, Throwable> onAttemptFailure =
157+
BinaryOperator<Throwable> onAttemptFailure =
158158
(@Nullable Throwable previouslyChosenException, Throwable mostRecentAttemptException) ->
159159
CommandOperationHelper.onRetryableWriteAttemptFailure(
160160
operationContext, previouslyChosenException, mostRecentAttemptException);

driver-core/src/main/com/mongodb/internal/operation/SyncOperationHelper.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
import org.bson.codecs.Decoder;
4242

4343
import java.util.function.BiFunction;
44+
import java.util.function.BinaryOperator;
4445
import java.util.function.Function;
4546
import java.util.function.Supplier;
4647

@@ -274,7 +275,7 @@ static <D, T> T createReadCommandAndExecute(
274275

275276
static <R> Supplier<R> decorateWriteWithRetries(final RetryState retryState,
276277
final OperationContext operationContext, final Supplier<R> writeFunction) {
277-
BiFunction<Throwable, Throwable, Throwable> onAttemptFailure =
278+
BinaryOperator<Throwable> onAttemptFailure =
278279
(@Nullable Throwable previouslyChosenException, Throwable mostRecentAttemptException) ->
279280
CommandOperationHelper.onRetryableWriteAttemptFailure(
280281
operationContext, previouslyChosenException, mostRecentAttemptException);
@@ -287,7 +288,7 @@ static <R> Supplier<R> decorateWriteWithRetries(final RetryState retryState,
287288

288289
static <R> Supplier<R> decorateReadWithRetries(final RetryState retryState, final OperationContext operationContext,
289290
final Supplier<R> readFunction) {
290-
BiFunction<Throwable, Throwable, Throwable> onAttemptFailure =
291+
BinaryOperator<Throwable> onAttemptFailure =
291292
(@Nullable Throwable previouslyChosenException, Throwable mostRecentAttemptException) ->
292293
CommandOperationHelper.onRetryableReadAttemptFailure(
293294
operationContext, previouslyChosenException, mostRecentAttemptException);

0 commit comments

Comments
 (0)