case class CircuitBreaker(name: String = "default", healthCheckPolicy: HealthCheckPolicy = ..., resultClassifier: (Any) ⇒ ResultClass = ResultClass.ALWAYS_SUCCEED, errorClassifier: (Throwable) ⇒ Failed = ResultClass.ALWAYS_RETRY, onOpenFailureHandler: (CircuitBreakerContext) ⇒ Unit = CircuitBreaker.throwOpenException, onStateChangeListener: (CircuitBreakerContext) ⇒ Unit = CircuitBreaker.reportStateChange, fallbackHandler: (Throwable) ⇒ Any = t => throw t, delayAfterMarkedDead: RetryPolicy = ..., recoveryPolicy: CircuitBreakerRecoveryPolicy = ..., nextProvingTimeMillis: Long = Long.MaxValue, provingWaitTimeMillis: Long = 0L, lastFailure: Option[Throwable] = None, currentState: AtomicReference[CircuitBreakerState] = ...) extends CircuitBreakerContext with LogSupport with Product with Serializable

Linear Supertypes
Product, Equals, LogSupport, LazyLogger, LoggingMethods, Serializable, Serializable, CircuitBreakerContext, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. CircuitBreaker
  2. Product
  3. Equals
  4. LogSupport
  5. LazyLogger
  6. LoggingMethods
  7. Serializable
  8. Serializable
  9. CircuitBreakerContext
  10. AnyRef
  11. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new CircuitBreaker(name: String = "default", healthCheckPolicy: HealthCheckPolicy = ..., resultClassifier: (Any) ⇒ ResultClass = ResultClass.ALWAYS_SUCCEED, errorClassifier: (Throwable) ⇒ Failed = ResultClass.ALWAYS_RETRY, onOpenFailureHandler: (CircuitBreakerContext) ⇒ Unit = CircuitBreaker.throwOpenException, onStateChangeListener: (CircuitBreakerContext) ⇒ Unit = CircuitBreaker.reportStateChange, fallbackHandler: (Throwable) ⇒ Any = t => throw t, delayAfterMarkedDead: RetryPolicy = ..., recoveryPolicy: CircuitBreakerRecoveryPolicy = ..., nextProvingTimeMillis: Long = Long.MaxValue, provingWaitTimeMillis: Long = 0L, lastFailure: Option[Throwable] = None, currentState: AtomicReference[CircuitBreakerState] = ...)

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native() @HotSpotIntrinsicCandidate()
  6. def close: CircuitBreaker.this.type
  7. macro def debug(message: Any, cause: Throwable): Unit
    Attributes
    protected
    Definition Classes
    LoggingMethods
  8. macro def debug(message: Any): Unit
    Attributes
    protected
    Definition Classes
    LoggingMethods
  9. val delayAfterMarkedDead: RetryPolicy
  10. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  11. macro def error(message: Any, cause: Throwable): Unit
    Attributes
    protected
    Definition Classes
    LoggingMethods
  12. macro def error(message: Any): Unit
    Attributes
    protected
    Definition Classes
    LoggingMethods
  13. val errorClassifier: (Throwable) ⇒ Failed
  14. val fallbackHandler: (Throwable) ⇒ Any
  15. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  16. def halfOpen: CircuitBreaker.this.type
  17. val healthCheckPolicy: HealthCheckPolicy
  18. macro def info(message: Any, cause: Throwable): Unit
    Attributes
    protected
    Definition Classes
    LoggingMethods
  19. macro def info(message: Any): Unit
    Attributes
    protected
    Definition Classes
    LoggingMethods
  20. def isConnected: Boolean

    Returns true when the circuit can execute the code ( OPEN or HALF_OPEN state)

  21. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  22. var lastFailure: Option[Throwable]
    Definition Classes
    CircuitBreakerCircuitBreakerContext
  23. macro def logAt(logLevel: LogLevel, message: Any): Unit
    Attributes
    protected
    Definition Classes
    LoggingMethods
  24. lazy val logger: Logger
    Attributes
    protected[this]
    Definition Classes
    LazyLogger
  25. val name: String
    Definition Classes
    CircuitBreakerCircuitBreakerContext
  26. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  27. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  28. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  29. def onOpenFailure(handler: (CircuitBreakerContext) ⇒ Unit): CircuitBreaker

    Defines the action when trying to use the open circuit.

    Defines the action when trying to use the open circuit. The default behavior is to throw CircuitBreakerOpenException

  30. val onOpenFailureHandler: (CircuitBreakerContext) ⇒ Unit
  31. def onStateChange(listener: (CircuitBreakerContext) ⇒ Unit): CircuitBreaker

    Set an event listener that monitors CircuitBreaker state changes

  32. val onStateChangeListener: (CircuitBreakerContext) ⇒ Unit
  33. def open: CircuitBreaker.this.type
  34. def recordFailure(e: Throwable): Unit

    Note: Use this method only for the standalone mode.

    Note: Use this method only for the standalone mode. Generally, using CircuitBreaker.run is sufficient.

    This method reports a failure state to the CircuitBreaker.

  35. def recordSuccess: Unit

    Note: Use this method only for the standalone mode.

    Note: Use this method only for the standalone mode. Generally, using CircuitBreaker.run is sufficient.

    This method reports a successful state to the CircuitBreaker.

  36. val recoveryPolicy: CircuitBreakerRecoveryPolicy
  37. def reset: Unit

    Reset the lastFailure and close the circuit

  38. val resultClassifier: (Any) ⇒ ResultClass
  39. def run[A](body: ⇒ A)(implicit arg0: ClassTag[A]): A

    Execute the body block through the CircuitBreaker.

    Execute the body block through the CircuitBreaker.

    If the state is OPEN, this will throw CircuitBreakerOpenException (fail-fast). The state will move to HALF_OPEN state after a certain amount of delay, determined by the delayAfterMarkedDead policy.

    If the state is HALF_OPEN, this method allows running the code block once, and if the result is successful, the state will move to CLOSED. If not, the state will be OPEN again.

    If the state is CLOSED, the code block will be executed normally. If the result is marked failure or nonRetryable exception is thrown, it will report to the failure to the HealthCheckPolicy. If this policy determines the target service is dead, the circuit will shift to OPEN state to block the future execution.

  40. def setState(newState: CircuitBreakerState): CircuitBreaker.this.type

    Force setting the current state.

  41. def state: CircuitBreakerState
    Definition Classes
    CircuitBreakerCircuitBreakerContext
  42. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  43. macro def trace(message: Any, cause: Throwable): Unit
    Attributes
    protected
    Definition Classes
    LoggingMethods
  44. macro def trace(message: Any): Unit
    Attributes
    protected
    Definition Classes
    LoggingMethods
  45. def verifyConnection: Unit

    Note: Use this method only for the standalone mode.

    Note: Use this method only for the standalone mode. Generally, using CircuiteBreaker.run is sufficient.

    If the connection is open, perform the specified action. The default behavior is fail-fast, i.e., throwing CircuitBreakerOpenException

  46. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  47. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  48. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  49. macro def warn(message: Any, cause: Throwable): Unit
    Attributes
    protected
    Definition Classes
    LoggingMethods
  50. macro def warn(message: Any): Unit
    Attributes
    protected
    Definition Classes
    LoggingMethods
  51. def withDelayAfterMarkedDead(retryPolicy: RetryPolicy): CircuitBreaker

    Set a delay policy until moving the state from OPEN to HALF_OPEN (probing) state.

    Set a delay policy until moving the state from OPEN to HALF_OPEN (probing) state. The default is Jittered-exponential backoff delay with the initial interval of 30 seconds.

  52. def withErrorClassifier(newErrorClassifier: (Throwable) ⇒ Failed): CircuitBreaker

    Set a classifier to determine whether the exception happened in the code block can be ignoreable or not for the accessing the target service.

  53. def withFallbackHandler(handler: (Throwable) ⇒ Any): CircuitBreaker

    Set a fallback handler which process the exception happened in the code block.

    Set a fallback handler which process the exception happened in the code block. The default is just throwing the exception as it is.

  54. def withHealthCheckPolicy(newHealthCheckPolicy: HealthCheckPolicy): CircuitBreaker

    Set a health check policy, which will be used to determine the state of the target service.

  55. def withName(newName: String): CircuitBreaker

    Set the name of this CircuitBreaker

  56. def withRecoveryPolicy(recoveryPolicy: CircuitBreakerRecoveryPolicy): CircuitBreaker

    Set a recovery policiy which determine if ths circuit breaker can recover from HALF_OPEN to CLOSED.

    Set a recovery policiy which determine if ths circuit breaker can recover from HALF_OPEN to CLOSED. The default policy recovers immediately if health check is once successful.

  57. def withResultClassifier(newResultClassifier: (Any) ⇒ ResultClass): CircuitBreaker

    Set a classifier to determine whether the execution result of the code block is successful or not.

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] ) @Deprecated
    Deprecated

Inherited from Product

Inherited from Equals

Inherited from LogSupport

Inherited from LazyLogger

Inherited from LoggingMethods

Inherited from Serializable

Inherited from Serializable

Inherited from CircuitBreakerContext

Inherited from AnyRef

Inherited from Any

Ungrouped