Java Code Examples for io.github.resilience4j.timelimiter.TimeLimiterConfig#Builder

The following examples show how to use io.github.resilience4j.timelimiter.TimeLimiterConfig#Builder . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TimeLimiterConfigCustomizer.java    From resilience4j with Apache License 2.0 6 votes vote down vote up
/**
 * A convenient method to create TimeLimiterConfigCustomizer using {@link Consumer}
 *
 * @param instanceName the name of the instance
 * @param consumer     delegate call to Consumer when  {@link TimeLimiterConfigCustomizer#customize(TimeLimiterConfig.Builder)}
 *                     is called
 * @return Customizer instance
 */
static TimeLimiterConfigCustomizer of(@NonNull String instanceName,
    @NonNull Consumer<TimeLimiterConfig.Builder> consumer) {
    return new TimeLimiterConfigCustomizer() {

        @Override
        public void customize(TimeLimiterConfig.Builder builder) {
            consumer.accept(builder);
        }

        @Override
        public String name() {
            return instanceName;
        }
    };
}
 
Example 2
Source File: TimeLimiterConfigurationProperties.java    From resilience4j with Apache License 2.0 6 votes vote down vote up
private static TimeLimiterConfig buildTimeLimiterConfig(
    TimeLimiterConfig.Builder builder, @Nullable InstanceProperties instanceProperties,
    CompositeCustomizer<TimeLimiterConfigCustomizer> compositeTimeLimiterCustomizer, String backendName) {

    if (instanceProperties == null) {
        return builder.build();
    }

    if (instanceProperties.getTimeoutDuration() != null) {
        builder.timeoutDuration(instanceProperties.getTimeoutDuration());
    }

    if (instanceProperties.getCancelRunningFuture() != null) {
        builder.cancelRunningFuture(instanceProperties.getCancelRunningFuture());
    }

    compositeTimeLimiterCustomizer.getCustomizer(backendName).ifPresent(
        timeLimiterConfigCustomizer -> timeLimiterConfigCustomizer.customize(builder));

    return builder.build();
}
 
Example 3
Source File: TimeLimiterConfigCustomizer.java    From resilience4j with Apache License 2.0 2 votes vote down vote up
/**
 * Customize time limiter configuration builder.
 *
 * @param configBuilder to be customized
 */
void customize(TimeLimiterConfig.Builder configBuilder);