public CompletableFuture<?> optimizeOldFiles(){
synchronized (this) {
    if (optimizeOldFiles)     return CompletableFuture.completedFuture(null);
    CompletableFuture<?> task=new CompletableFuture<>();
    Thread thr=new Thread(null);
    thr.setDaemon(true);
    thr.start();
    pendingTasks.add(task);
    optimizeOldFiles=true;
    task.whenComplete(null);
    return task;
  }
}

public CompletableFuture < ? > optimizeOldFiles ( ) { synchronized ( this ) { if ( optimizeOldFiles ) return CompletableFuture . completedFuture ( null ) ; CompletableFuture < ? > task = new CompletableFuture < > ( ) ; Thread thr = new Thread ( null ) ; thr . setDaemon ( true ) ; thr . start ( ) ; pendingTasks . add ( task ) ; optimizeOldFiles = true ; task . whenComplete ( null ) ; return task ; } }
start optimization of old files .
