Returns a Supplier that supplies a promise that is completed with the result of calling the {@code supplier} on the
{@code scheduler}.
356787
@SuppressWarnings("unchecked")
  static Supplier<CompletableFuture<ExecutionResult>> makeAsync(Supplier<CompletableFuture<ExecutionResult>> supplier,
      Scheduler scheduler, FailsafeFuture<Object> future) {
    return () -> {
      CompletableFuture<ExecutionResult> promise = new CompletableFuture<>();
      Callable<Object> callable = () -> supplier.get().handle((result, error) -> {
        // Propagate result
        if (result != null)
          promise.complete(result);
        else
          promise.completeExceptionally(error);
        return result;
      });

      try {
        future.inject((Future) scheduler.schedule(callable, 0, TimeUnit.NANOSECONDS));
      } catch (Exception e) {
        promise.completeExceptionally(e);
      }
      return promise;
    };
  }
795485
public static <T> Supplier<T> once(final Supplier<T> function) {
        return new Supplier<T>() {
            private volatile boolean executed;
            private T result;
            @Override
            public T get() {
                if (!executed) {
                    executed = true;
                    result = function.get();
                }
                return result;
            }
        };
    }
329872
private <R> CompletableFuture<R> execute(Callable<R> operation) {
        return CompletableFuture.supplyAsync(() -> {
            try {
                return operation.call();
            } catch (Exception ex) {
                throw new CompletionException(ex);
            }
        }, this.executor);
    }
1284144
public static <T> Supplier<T> synchronizedSupplier(Supplier<T> delegate) {
		return new ThreadSafeSupplier<>(Objects.requireNonNull(delegate));
	}
1035612
public <R> R wrapClassLoader(Supplier<R> supplier) {
		try (TemporaryClassLoaderContext tmpCl = new TemporaryClassLoaderContext(classLoader)){
			return supplier.get();
		}
	}
308023
public static <R> Supplier<R> call(Object target, Method method, Object... parameters) {
        return new MethodSupplier<R>(target, method, parameters);
    }
329980
public static <T> Supplier<T> supplier(CheckedSupplier<T> supplier) {
        return supplier(supplier, THROWABLE_TO_RUNTIME_EXCEPTION);
    }
1052458
@NotNull
	@SafeVarargs
	public static <T> Promise<T> firstSuccessful(AsyncSupplier<? extends T>... promises) {
		return first(isResult(), promises);
	}
41488
public T computeIfAbsent(final Supplier<T> lazy) {
        final T val = get();
        if (val == UNSET)
            return setOnceFromSupplier(lazy);

        return val;

    }
126052
public static <T, E extends Exception> Supplier<T> rethrowSupplier(SupplierWithExceptions<T, E> function) throws E {
        return () -> {
            try {
                return function.get();
            } catch (Exception exception) {
                throwAsUnchecked(exception);
                return null;
            }
        };
    }
261509
public FluentMatchingR<T, R> orElse(Supplier<R> supplier) {
    patterns.add(Pattern.of(t -> true, t -> supplier.get()));
    return this;
  }
469762
public static <U> CompletableFuture<U> supplyAsync(Supplier<U> supplier,
            Function<Throwable, U> failureFunction) {
        return CompletableFuture.supplyAsync(supplier)
                .exceptionally(throwable -> handleExceptionAndReturn(log,
                        throwable, "supplyAsync",
                        () -> failureFunction.apply(throwable), supplier));
    }
249428
private <R> R runInNewTx(final SQLSupplier<R> supplier) {
		try (LocalTransactionContext txContext = new LocalTransactionContext(this.connectionSupplier,
				this.sqlFilterManager)) {
			this.txCtxStack.push(txContext);
			try {
				return supplier.get();
			} catch (Exception ex) {
				txContext.setRollbackOnly();
				throw ex;
			} finally {
				try {
					txContext.close();
				} finally {
					this.txCtxStack.pop();
				}
			}
		}
	}
622623
public static <T> Supplier<T> memoized(Supplier<T> actual) {
        return new Supplier<T>() {
            Supplier<T> delegate = this::initialize;
            boolean initialized;

            public T get() {
                return delegate.get();
            }

            private synchronized T initialize() {
                if (!initialized) {
                    T value = actual.get();
                    delegate = () -> value;
                    initialized = true;
                }
                return delegate.get();
            }
        };
    }
833336
public static <U> CompletableFuture<U> supplyAsync(Supplier<U> supplier) {
        return CompletableFuture
                .supplyAsync(handleSupplierWithException(supplier));
    }
1215438
public static <T> Supplier<T> recover(Supplier<T> supplier, Function<Exception, T> exceptionHandler){
        return () -> {
            try{
                return supplier.get();
            }catch (Exception exception){
                return exceptionHandler.apply(exception);
            }
        };
    }
425389
public static <T, E extends Throwable> @NonNull Supplier<T> rethrowSupplier(final @NonNull ThrowingSupplier<T, E> supplier) {
    return supplier;
  }