Class CircuitBreakerBundle.Builder<C extends io.dropwizard.Configuration>
- java.lang.Object
-
- org.sdase.commons.server.circuitbreaker.CircuitBreakerBundle.Builder<C>
-
- All Implemented Interfaces:
CircuitBreakerBundle.ConfigurationBuilder
,CircuitBreakerBundle.ExceptionBuilder<C>
,CircuitBreakerBundle.FinalBuilder<C>
- Enclosing class:
- CircuitBreakerBundle<T extends io.dropwizard.Configuration>
public static class CircuitBreakerBundle.Builder<C extends io.dropwizard.Configuration> extends java.lang.Object implements CircuitBreakerBundle.ConfigurationBuilder, CircuitBreakerBundle.ExceptionBuilder<C>, CircuitBreakerBundle.FinalBuilder<C>
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CircuitBreakerBundle<C>
build()
Create a new instance.CircuitBreakerBundle.ExceptionBuilder<C>
ignoreExceptions(java.lang.Class<? extends java.lang.Throwable>... errorClasses)
Configures a list of error classes that are ignored as a failure and thus do not increase the failure rate.CircuitBreakerBundle.ExceptionBuilder<C>
recordExceptions(java.lang.Class<? extends java.lang.Throwable>... errorClasses)
Configures a list of error classes that are recorded as a failure and thus increase the failure rate.<T extends io.dropwizard.Configuration>
CircuitBreakerBundle.ExceptionBuilder<T>withConfigProvider(CircuitBreakerConfigurationProvider<T> provider)
Use a provider for a custom default configuration for circuit breakers created using the bundle.<T extends io.dropwizard.Configuration>
CircuitBreakerBundle.ExceptionBuilder<T>withCustomConfig(CircuitBreakerConfiguration config)
Provide a custom default configuration for circuit breakers created using the bundle.<T extends io.dropwizard.Configuration>
CircuitBreakerBundle.ExceptionBuilder<T>withDefaultConfig()
Use the default configuration for circuit breakers created using the bundle.
-
-
-
Method Detail
-
withCustomConfig
public <T extends io.dropwizard.Configuration> CircuitBreakerBundle.ExceptionBuilder<T> withCustomConfig(CircuitBreakerConfiguration config)
Description copied from interface:CircuitBreakerBundle.ConfigurationBuilder
Provide a custom default configuration for circuit breakers created using the bundle.- Specified by:
withCustomConfig
in interfaceCircuitBreakerBundle.ConfigurationBuilder
- Type Parameters:
T
- Type of the Dropwizard configuration.- Parameters:
config
- The circuit breaker configuration.- Returns:
- the same builder instance
-
withConfigProvider
public <T extends io.dropwizard.Configuration> CircuitBreakerBundle.ExceptionBuilder<T> withConfigProvider(CircuitBreakerConfigurationProvider<T> provider)
Description copied from interface:CircuitBreakerBundle.ConfigurationBuilder
Use a provider for a custom default configuration for circuit breakers created using the bundle.- Specified by:
withConfigProvider
in interfaceCircuitBreakerBundle.ConfigurationBuilder
- Type Parameters:
T
- Type of the Dropwizard configuration.- Parameters:
provider
- Provider to extract the circuit breaker configuration from the Dropwizard configuration.- Returns:
- the same builder instance
-
withDefaultConfig
public <T extends io.dropwizard.Configuration> CircuitBreakerBundle.ExceptionBuilder<T> withDefaultConfig()
Description copied from interface:CircuitBreakerBundle.ConfigurationBuilder
Use the default configuration for circuit breakers created using the bundle.- Specified by:
withDefaultConfig
in interfaceCircuitBreakerBundle.ConfigurationBuilder
- Type Parameters:
T
- Type of the Dropwizard configuration.- Returns:
- the same builder instance
-
recordExceptions
public CircuitBreakerBundle.ExceptionBuilder<C> recordExceptions(java.lang.Class<? extends java.lang.Throwable>... errorClasses)
Description copied from interface:CircuitBreakerBundle.ExceptionBuilder
Configures a list of error classes that are recorded as a failure and thus increase the failure rate. Any exception matching or inheriting from one of the list should count as a failure, unless ignored- Specified by:
recordExceptions
in interfaceCircuitBreakerBundle.ExceptionBuilder<C extends io.dropwizard.Configuration>
- Parameters:
errorClasses
- the error classes that are recorded- Returns:
- the same builder instance
-
ignoreExceptions
public CircuitBreakerBundle.ExceptionBuilder<C> ignoreExceptions(java.lang.Class<? extends java.lang.Throwable>... errorClasses)
Description copied from interface:CircuitBreakerBundle.ExceptionBuilder
Configures a list of error classes that are ignored as a failure and thus do not increase the failure rate. Any exception matching or inheriting from one of the list will not count as a failure, even if marked via record.- Specified by:
ignoreExceptions
in interfaceCircuitBreakerBundle.ExceptionBuilder<C extends io.dropwizard.Configuration>
- Parameters:
errorClasses
- the error classes that are ignored- Returns:
- the same builder instance
-
build
public CircuitBreakerBundle<C> build()
Description copied from interface:CircuitBreakerBundle.FinalBuilder
Create a new instance.- Specified by:
build
in interfaceCircuitBreakerBundle.FinalBuilder<C extends io.dropwizard.Configuration>
- Returns:
- A new
CircuitBreakerBundle
-
-