/** * Configures the {@code fallback} to be executed if execution fails. The {@code fallback} applies an {@link * ExecutionAttemptedEvent}. * * @throws NullPointerException if {@code fallback} is null */ @SuppressWarnings("unchecked") public static <R> Fallback<R> of(CheckedFunction<ExecutionAttemptedEvent<? extends R>, ? extends R> fallback) { return new Fallback<>(Assert.notNull((CheckedFunction) fallback, "fallback"), false); }
/** * Configures the {@code fallback} to be executed asynchronously if execution fails. The {@code fallback} applies an * {@link ExecutionAttemptedEvent}. * * @throws NullPointerException if {@code fallback} is null */ @SuppressWarnings("unchecked") public static <R> Fallback<R> ofAsync(CheckedFunction<ExecutionAttemptedEvent<? extends R>, ? extends R> fallback) { return new Fallback<>(Assert.notNull((CheckedFunction) fallback, "fallback"), true); }
/** * Configures the {@code fallback} to be executed asynchronously if execution fails. * * @throws NullPointerException if {@code fallback} is null */ public static <R> Fallback<R> ofAsync(CheckedRunnable fallback) { return new Fallback<>(Functions.fnOf(Assert.notNull(fallback, "fallback")), true); }
/** * Configures the {@code fallback} to be executed asynchronously if execution fails. * * @throws NullPointerException if {@code fallback} is null */ @SuppressWarnings("unchecked") public static <R> Fallback<R> ofAsync(CheckedSupplier<? extends R> fallback) { return new Fallback<>(Functions.fnOf((CheckedSupplier<R>) Assert.notNull(fallback, "fallback")), true); }
/** * Configures the {@code fallback} to be executed asynchronously if execution fails. The {@code fallback} accepts an * {@link ExecutionAttemptedEvent}. * * @throws NullPointerException if {@code fallback} is null */ @SuppressWarnings("unchecked") public static <R> Fallback<R> ofAsync(CheckedConsumer<ExecutionAttemptedEvent<? extends R>> fallback) { return new Fallback<>(Functions.fnOf(Assert.notNull((CheckedConsumer) fallback, "fallback")), true); }
/** * Configures the {@code fallback} to be executed if execution fails. * * @throws NullPointerException if {@code fallback} is null */ public static <R> Fallback<R> of(CheckedRunnable fallback) { return new Fallback<>(Functions.fnOf(Assert.notNull(fallback, "fallback")), false); }
/** * Configures the {@code fallback} to be executed if execution fails. The {@code fallback} accepts an {@link * ExecutionAttemptedEvent}. * * @throws NullPointerException if {@code fallback} is null */ @SuppressWarnings("unchecked") public static <R> Fallback<R> of(CheckedConsumer<ExecutionAttemptedEvent<? extends R>> fallback) { return new Fallback<>(Functions.fnOf(Assert.notNull((CheckedConsumer) fallback, "fallback")), false); }
/** * Configures the {@code fallback} to be executed if execution fails. * * @throws NullPointerException if {@code fallback} is null */ @SuppressWarnings("unchecked") public static <R> Fallback<R> of(CheckedSupplier<? extends R> fallback) { return new Fallback<>(Functions.fnOf((CheckedSupplier<R>) Assert.notNull(fallback, "fallback")), false); }
/** * Configures the {@code fallback} result to be returned if execution fails. * * @throws NullPointerException if {@code fallback} is null */ @SuppressWarnings("rawtypes") public static <R> Fallback<R> of(R fallback) { return new Fallback<>(Functions.fnOf(Assert.notNull(fallback, "fallback")), false); }