Skip to content

Commit d232fff

Browse files
kazuki-marstoyanchev
authored andcommitted
Use whenComplete since (null) return value not needed
1 parent 8f525f0 commit d232fff

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

spring-core/src/main/java/org/springframework/util/concurrent/CompletableToListenableFutureAdapter.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import java.util.concurrent.ExecutionException;
2222
import java.util.concurrent.TimeUnit;
2323
import java.util.concurrent.TimeoutException;
24+
import java.util.function.BiConsumer;
2425

2526
/**
2627
* Adapts a {@link CompletableFuture} or {@link CompletionStage} into a
@@ -50,14 +51,13 @@ public CompletableToListenableFutureAdapter(CompletionStage<T> completionStage)
5051
*/
5152
public CompletableToListenableFutureAdapter(CompletableFuture<T> completableFuture) {
5253
this.completableFuture = completableFuture;
53-
this.completableFuture.handle((result, ex) -> {
54+
this.completableFuture.whenComplete((result, ex) -> {
5455
if (ex != null) {
5556
callbacks.failure(ex);
5657
}
5758
else {
5859
callbacks.success(result);
5960
}
60-
return null;
6161
});
6262
}
6363

0 commit comments

Comments
 (0)