src/main/java/org/michailov/async/WhenReady.java
private static <S, R> CompletableFuture<R> completeAsync(CompletableFuture<R> future, WhenReadyArguments<S, R> args) {
        try {
            if (!mustExit(future, args)) {
                if (args.readyOrDone.test(args.state)) {
                    args.readyRetryCount = 0;
                    completeFutureSafe(future, args.result);
                }
                else {
                    Executor.throttleExecute(() -> completeAsync(future, args), ++args.readyRetryCount);
                }
            }
        }
        catch (Throwable ex) {
            completeFutureExceptionallySafe(future, ex);
        }
        
        String logMessage = String.format("future=%1$d , class=unknown , event=CreateForComplete", future.hashCode());
        Logger.getLogger().fine(logMessage);
        
        return future;
    }
/**
     * Shared implementation of all {@link #completeAsync} overloads. 
     */
Shared implementation of all  #completeAsync overloads.
Shared implementation of all #completeAsync overloads .
private static <S, R> CompletableFuture<R> completeAsync(CompletableFuture<R> future, WhenReadyArguments<S, R> args) {
        try {
            if (!mustExit(future, args)) {
                if (args.readyOrDone.test(args.state)) {
                    args.readyRetryCount = 0;
                    completeFutureSafe(future, args.result);
                }
                else {
                    Executor.throttleExecute(() -> completeAsync(future, args), ++args.readyRetryCount);
                }
            }
        }
        catch (Throwable ex) {
            completeFutureExceptionallySafe(future, ex);
        }
        String logMessage = String.format("future=%1$d , class=unknown , event=CreateForComplete", future.hashCode());
        Logger.getLogger().fine(logMessage);
        return future;
    }
private static < S , R > CompletableFuture < R > completeAsync ( CompletableFuture < R > future , WhenReadyArguments < S , R > args ) { try { if ( ! mustExit ( future , args ) ) { if ( args . readyOrDone . test ( args . state ) ) { args . readyRetryCount = 0 ; completeFutureSafe ( future , args . result ) ; } else { Executor . throttleExecute ( ( ) -> completeAsync ( future , args ) , ++ args . readyRetryCount ) ; } } } catch ( Throwable ex ) { completeFutureExceptionallySafe ( future , ex ) ; } String logMessage = String . format ( "future=%1$d , class=unknown , event=CreateForComplete" , future . hashCode ( ) ) ; Logger . getLogger ( ) . fine ( logMessage ) ; return future ; }
Shared implementation of all {@link #completeAsync} overloads.
Shared implementation of all { @link #completeAsync } overloads .