BewareMyPower commented on code in PR #18392:
URL: https://github.com/apache/pulsar/pull/18392#discussion_r1021038684
##########
pulsar-client/src/main/java/org/apache/pulsar/client/impl/PersistentAcknowledgmentsGroupingTracker.java:
##########
@@ -66,8 +67,8 @@ public class PersistentAcknowledgmentsGroupingTracker
implements Acknowledgments
private final long acknowledgementGroupTimeMicros;
- private volatile TimedCompletableFuture<Void> currentIndividualAckFuture;
- private volatile TimedCompletableFuture<Void> currentCumulativeAckFuture;
+ private volatile CompletableFuture<Void> currentIndividualAckFuture;
+ private volatile CompletableFuture<Void> currentCumulativeAckFuture;
Review Comment:
With `TimedCompletableFuture`, the `Optional` method chains would be:
```java
readLock.map(__ -> currentIndividualAckFuture).orElse(/* null completed
TimedCompletableFuture */);
```
We need to adding a static `completedFuture` method like:
```java
public static <U> TimedCompletableFuture<U> completedFuture(U value) {
TimedCompletableFuture<U> future = new TimedCompletableFuture<>();
future.complete(value);
return future;
}
```
But it's a little different from `CompletableFuture#completedFuture`, which
only calls the constructor with the value. So I decided to keep the current
logic.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]