public class BreakerBuilder extends Object
Breaker instances having any combination of the following features:
| Modifier and Type | Method and Description |
|---|---|
BreakerBuilder |
autoResetAfter(long autoResetInterval,
@NotNull TimeUnit autoResetUnit)
Configure the breaker to automatically reset a given time after a failure has occurred.
|
Breaker |
build() |
static BreakerBuilder |
newBuilder() |
BreakerBuilder |
storeStateIn(@NotNull ConcurrentMap<String,Object> map,
@NotNull String keyPrefix)
Configure the breaker to use the provided
Map to store its state. |
BreakerBuilder |
storeStateIn(@NotNull StateStore stateStore)
Configure the breaker to use the provided
StateStore to store its state. |
BreakerBuilder |
timeSource(@NotNull org.rnorth.ducttape.circuitbreakers.TimeSource timeSource)
Use a
TimeSource instance to track time elapsed since last failure. |
public static BreakerBuilder newBuilder()
public Breaker build()
Breaker instance configured using settings passed in to this
`BreakerBuilder`public BreakerBuilder timeSource(@NotNull @NotNull org.rnorth.ducttape.circuitbreakers.TimeSource timeSource)
TimeSource instance to track time elapsed since last failure.
Mainly intended for use in testing.timeSource - a time source instance to track time elapsed since last failure.public BreakerBuilder autoResetAfter(long autoResetInterval, @NotNull @NotNull TimeUnit autoResetUnit)
autoResetInterval - the interval lengthautoResetUnit - the units of the intervalpublic BreakerBuilder storeStateIn(@NotNull @NotNull ConcurrentMap<String,Object> map, @NotNull @NotNull String keyPrefix)
Map to store its state. The keyPrefixis used to uniquely identify the breaker's entries in the map.
keyPrefixshould be unique; behaviour is undefined if it is not. Additionally, behaviour is undefined if entries are directly modified.
map - the map to use for storagekeyPrefix - a unique prefix for the +Breaker+'s entries in the mappublic BreakerBuilder storeStateIn(@NotNull @NotNull StateStore stateStore)
StateStore to store its state.stateStore - an instance of StateStore to store state inCopyright © 2019. All rights reserved.