code: public synchronized CompletableFuture<Void> compact(Compaction compaction) {
      final CompletableFuture<Void> future = new CompletableFuture<>();
      ThreadContext context = ThreadContext.currentContext();
      this.future.whenComplete((result, error) -> compact(compaction, future, context));
      this.future = future;
      return this.future;
    }
docs: Compacts the log using the given {@link Compaction}.
  <p>
  The provided {@link CompactionManager} will be queried for a list of {@link CompactionTask}s to run.
  Tasks will be run in parallel in a pool of background threads, and the returned {@link CompletableFuture}
  will be completed once those tasks have completed.
  
  @param compaction The compaction strategy.
  @return A completable future to be completed once the log has been compacted.