com.github.norwae.circuit4stream.ResetSettings.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of circuit4stream_2.12 Show documentation
Show all versions of circuit4stream_2.12 Show documentation
This module packages a circuit breaker that can be used to avoid overloading or otherwise depending on a temporarily unavailable (remote) system. The central use of the circuit breaker is to prevent failures from one system to cascade to other systems in an unchecked manner. Thus, our implementation is chiefly concerned with replacing a failing component with another component that fails in a very predictable manner. These failures are not "dropped" or otherwise made invisible, and still need to be handled, but they will occur in a predictable, and hopefully usable manner.
The newest version!
package com.github.norwae.circuit4stream
import scala.concurrent.duration.{Duration, FiniteDuration}
/**
* Determine how a opened breaker should attempt to reset itself.
*
* @param initialResetDuration wait time for first reset attempt
* @param maximumResetDuration maximum duration between two attempts
* @param backoffFactor increment between two attempts, must be >= 1
*/
case class ResetSettings(initialResetDuration: FiniteDuration, maximumResetDuration: Duration = Duration.Inf, backoffFactor: Double = 2) {
require(backoffFactor >= 1)
}