Object/Class

monix.catnap

CircuitBreaker

Related Docs: class CircuitBreaker | package catnap

Permalink

object CircuitBreaker extends CircuitBreakerDocs

Linear Supertypes
CircuitBreakerDocs, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. CircuitBreaker
  2. CircuitBreakerDocs
  3. AnyRef
  4. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. final class Builders[F[_]] extends AnyVal with CircuitBreakerDocs

    Permalink

    Builders specified for CircuitBreaker, using the Partially-Applied Type technique.

  2. final case class Closed(failures: Int) extends State with Product with Serializable

    Permalink

    The initial State of the CircuitBreaker.

    The initial State of the CircuitBreaker. While in this state the circuit breaker allows tasks to be executed.

    Contract:

    • Exceptions increment the failures counter
    • Successes reset the failure count to zero
    • When the failures counter reaches the maxFailures count, the breaker is tripped into the Open state
    failures

    is the current failures count

  3. final class HalfOpen extends State

    Permalink

    State of the CircuitBreaker in which the circuit breaker has already allowed a task to go through, as a reset attempt, in order to test the connection.

    State of the CircuitBreaker in which the circuit breaker has already allowed a task to go through, as a reset attempt, in order to test the connection.

    Contract:

    • The first task when Open has expired is allowed through without failing fast, just before the circuit breaker is evolved into the HalfOpen state
    • All tasks attempted in HalfOpen fail-fast with an exception just as in Open state
    • If that task attempt succeeds, the breaker is reset back to the Closed state, with the resetTimeout and the failures count also reset to initial values
    • If the first call fails, the breaker is tripped again into the Open state (the resetTimeout is multiplied by the exponential backoff factor)
  4. final class Open extends State

    Permalink

    State of the CircuitBreaker in which the circuit breaker rejects all tasks with an ExecutionRejectedException.

    State of the CircuitBreaker in which the circuit breaker rejects all tasks with an ExecutionRejectedException.

    Contract:

    • all tasks fail fast with ExecutionRejectedException
    • after the configured resetTimeout, the circuit breaker enters a HalfOpen state, allowing one task to go through for testing the connection
  5. sealed abstract class State extends AnyRef

    Permalink

    An enumeration that models the internal state of CircuitBreaker, kept in an Atomic for synchronization.

    An enumeration that models the internal state of CircuitBreaker, kept in an Atomic for synchronization.

    The initial state when initializing a CircuitBreaker is Closed. The available states:

    • Closed in case tasks are allowed to go through
    • Open in case the circuit breaker is active and rejects incoming tasks
    • HalfOpen in case a reset attempt was triggered and it is waiting for the result in order to evolve in Closed, or back to Open
  6. type Timestamp = Long

    Permalink

    Type-alias to document timestamps specified in milliseconds, as returned by Scheduler.clockRealTime.

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. object HalfOpen

    Permalink
  5. object Open

    Permalink
  6. def apply[F[_]](implicit F: Sync[F]): Builders[F]

    Permalink

    Builders specified for CircuitBreaker, using the Partially-Applied Type technique.

    Builders specified for CircuitBreaker, using the Partially-Applied Type technique.

    Example:

    import scala.concurrent.duration._
    import cats.effect.{IO, Clock}
    implicit val clock = Clock.create[IO]
    
    val cb = CircuitBreaker[IO].of(
      maxFailures = 10,
      resetTimeout = 3.second,
      exponentialBackoffFactor = 2
    )
  7. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  8. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  9. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  10. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  11. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  12. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  13. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  14. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  15. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  16. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  17. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  18. def of[F[_]](maxFailures: Int, resetTimeout: FiniteDuration, exponentialBackoffFactor: Double = 1.0, maxResetTimeout: Duration = Duration.Inf, padding: PaddingStrategy = NoPadding)(implicit F: Sync[F], clock: Clock[F]): F[CircuitBreaker[F]]

    Permalink

    Safe builder.

    Safe builder.

    maxFailures

    is the maximum count for failures before opening the circuit breaker

    resetTimeout

    is the timeout to wait in the Open state before attempting a close of the circuit breaker (but without the backoff factor applied)

    exponentialBackoffFactor

    is a factor to use for resetting the resetTimeout when in the HalfOpen state, in case the attempt to Close fails

    maxResetTimeout

    is the maximum timeout the circuit breaker is allowed to use when applying the exponentialBackoffFactor

    padding

    is the PaddingStrategy to apply to the underlying atomic reference used, to use in case contention and "false sharing" become a problem

    See also

    CircuitBreaker[F].of, the version that uses the "partially-applied type technique"

  19. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  20. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  21. def unsafe[F[_]](maxFailures: Int, resetTimeout: FiniteDuration, exponentialBackoffFactor: Double = 1.0, maxResetTimeout: Duration = Duration.Inf, padding: PaddingStrategy = NoPadding)(implicit F: Sync[F], clock: Clock[F]): CircuitBreaker[F]

    Permalink

    Unsafe builder (that violates referential transparency).

    Unsafe builder (that violates referential transparency).

    UNSAFE WARNING: this builder is unsafe to use because creating a circuit breaker allocates shared mutable states, which violates referential transparency. Prefer to use the safe CircuitBreaker[F].of and pass that CircuitBreaker around as a plain parameter.

    maxFailures

    is the maximum count for failures before opening the circuit breaker

    resetTimeout

    is the timeout to wait in the Open state before attempting a close of the circuit breaker (but without the backoff factor applied)

    exponentialBackoffFactor

    is a factor to use for resetting the resetTimeout when in the HalfOpen state, in case the attempt to Close fails

    maxResetTimeout

    is the maximum timeout the circuit breaker is allowed to use when applying the exponentialBackoffFactor

    padding

    is the PaddingStrategy to apply to the underlying atomic reference used, to use in case contention and "false sharing" become a problem

    Annotations
    @UnsafeBecauseImpure()
    See also

    CircuitBreaker[F].unsafe, the version that uses the "partially-applied type technique"

  22. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  23. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  24. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from CircuitBreakerDocs

Inherited from AnyRef

Inherited from Any

Ungrouped