ivankelly commented on a change in pull request #1809: Change LedgerManager to use CompletableFuture URL: https://github.com/apache/bookkeeper/pull/1809#discussion_r233204066
########## File path: bookkeeper-server/src/main/java/org/apache/bookkeeper/meta/CleanupLedgerManager.java ########## @@ -75,11 +76,17 @@ public LedgerRange next() throws IOException { } } + private static final CompletableFuture<Versioned<LedgerMetadata>> closedPromise = new CompletableFuture<>(); Review comment: https://github.com/bpupadhyaya/openjdk-8/blob/45af329463a45955ea2759b89cb0ebfe40570c3f/jdk/src/share/classes/java/util/concurrent/CompletableFuture.java#L2015 If the future is complete, nothing is queued. It's executed straight away. I've no problem creating a future each time, this isn't fast path code, but it is safe to use a future like this. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services