src/main/java/org/michailov/async/WhenReady.java
private static <S, R> CompletableFuture<R> startApplyLoopAsync(CompletableFuture<R> future, WhenReadyArguments<S, R> args) {
        if (mustExit(future, args)) {
            return future;
        }

        CompletableFuture<R> whenReady = new CompletableFuture<R>();
        WhenReady.completeAsync(whenReady, args); 
        whenReady.whenCompleteAsync((a, ex) -> applyLoopAsync(future, args, ex));

        String logMessage = String.format("future=%1$d , class=unknown , event=CreateForStartApplyLoop", future.hashCode());
        Logger.getLogger().fine(logMessage);
        
        return future;
    }
/**
     * Shared implementation of all {@link #applyAsync} and {@link #startApplyLoop} overloads. 
     */
Shared implementation of all  #applyAsync and  #startApplyLoop overloads.
Shared implementation of all #applyAsync and #startApplyLoop overloads .
private static <S, R> CompletableFuture<R> startApplyLoopAsync(CompletableFuture<R> future, WhenReadyArguments<S, R> args) {
        if (mustExit(future, args)) {
            return future;
        }
        CompletableFuture<R> whenReady = new CompletableFuture<R>();
        WhenReady.completeAsync(whenReady, args); 
        whenReady.whenCompleteAsync((a, ex) -> applyLoopAsync(future, args, ex));
        String logMessage = String.format("future=%1$d , class=unknown , event=CreateForStartApplyLoop", future.hashCode());
        Logger.getLogger().fine(logMessage);
        return future;
    }
private static < S , R > CompletableFuture < R > startApplyLoopAsync ( CompletableFuture < R > future , WhenReadyArguments < S , R > args ) { if ( mustExit ( future , args ) ) { return future ; } CompletableFuture < R > whenReady = new CompletableFuture < R > ( ) ; WhenReady . completeAsync ( whenReady , args ) ; whenReady . whenCompleteAsync ( ( a , ex ) -> applyLoopAsync ( future , args , ex ) ) ; String logMessage = String . format ( "future=%1$d , class=unknown , event=CreateForStartApplyLoop" , future . hashCode ( ) ) ; Logger . getLogger ( ) . fine ( logMessage ) ; return future ; }
Shared implementation of all {@link #applyAsync} and {@link #startApplyLoop} overloads.
Shared implementation of all { @link #applyAsync } and { @link #startApplyLoop } overloads .