Class/Object

wvlet.airframe.control

CircuitBreaker

Related Docs: object CircuitBreaker | package control

Permalink

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] = ...)

    Permalink

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. final def asInstanceOf[T0]: T0

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

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @HotSpotIntrinsicCandidate() @throws( ... )
  6. def close: CircuitBreaker.this.type

    Permalink
  7. macro def debug(message: Any, cause: Throwable): Unit

    Permalink
    Attributes
    protected
    Definition Classes
    LoggingMethods
  8. macro def debug(message: Any): Unit

    Permalink
    Attributes
    protected
    Definition Classes
    LoggingMethods
  9. val delayAfterMarkedDead: RetryPolicy

    Permalink
  10. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  11. macro def error(message: Any, cause: Throwable): Unit

    Permalink
    Attributes
    protected
    Definition Classes
    LoggingMethods
  12. macro def error(message: Any): Unit

    Permalink
    Attributes
    protected
    Definition Classes
    LoggingMethods
  13. val errorClassifier: (Throwable) ⇒ Failed

    Permalink
  14. val fallbackHandler: (Throwable) ⇒ Any

    Permalink
  15. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
    Annotations
    @HotSpotIntrinsicCandidate()
  16. def halfOpen: CircuitBreaker.this.type

    Permalink
  17. val healthCheckPolicy: HealthCheckPolicy

    Permalink
  18. macro def info(message: Any, cause: Throwable): Unit

    Permalink
    Attributes
    protected
    Definition Classes
    LoggingMethods
  19. macro def info(message: Any): Unit

    Permalink
    Attributes
    protected
    Definition Classes
    LoggingMethods
  20. def isConnected: Boolean

    Permalink

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

  21. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  22. var lastFailure: Option[Throwable]

    Permalink
    Definition Classes
    CircuitBreakerCircuitBreakerContext
  23. macro def logAt(logLevel: LogLevel, message: Any): Unit

    Permalink
    Attributes
    protected
    Definition Classes
    LoggingMethods
  24. lazy val logger: Logger

    Permalink
    Attributes
    protected[this]
    Definition Classes
    LazyLogger
  25. val name: String

    Permalink
    Definition Classes
    CircuitBreakerCircuitBreakerContext
  26. final def ne(arg0: AnyRef): Boolean

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

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @HotSpotIntrinsicCandidate()
  28. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @HotSpotIntrinsicCandidate()
  29. def onOpenFailure(handler: (CircuitBreakerContext) ⇒ Unit): CircuitBreaker

    Permalink

    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

    Permalink
  31. def onStateChange(listener: (CircuitBreakerContext) ⇒ Unit): CircuitBreaker

    Permalink

    Set an event listener that monitors CircuitBreaker state changes

  32. val onStateChangeListener: (CircuitBreakerContext) ⇒ Unit

    Permalink
  33. def open: CircuitBreaker.this.type

    Permalink
  34. def recordFailure(e: Throwable): Unit

    Permalink

    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

    Permalink

    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

    Permalink
  37. def reset: Unit

    Permalink

    Reset the lastFailure and close the circuit

  38. val resultClassifier: (Any) ⇒ ResultClass

    Permalink
  39. def run[A](body: ⇒ A)(implicit arg0: ClassTag[A]): A

    Permalink

    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

    Permalink

    Force setting the current state.

  41. def state: CircuitBreakerState

    Permalink
    Definition Classes
    CircuitBreakerCircuitBreakerContext
  42. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  43. macro def trace(message: Any, cause: Throwable): Unit

    Permalink
    Attributes
    protected
    Definition Classes
    LoggingMethods
  44. macro def trace(message: Any): Unit

    Permalink
    Attributes
    protected
    Definition Classes
    LoggingMethods
  45. def verifyConnection: Unit

    Permalink

    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

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

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  48. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  49. macro def warn(message: Any, cause: Throwable): Unit

    Permalink
    Attributes
    protected
    Definition Classes
    LoggingMethods
  50. macro def warn(message: Any): Unit

    Permalink
    Attributes
    protected
    Definition Classes
    LoggingMethods
  51. def withDelayAfterMarkedDead(retryPolicy: RetryPolicy): CircuitBreaker

    Permalink

    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

    Permalink

    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

    Permalink

    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

    Permalink

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

  55. def withName(newName: String): CircuitBreaker

    Permalink

    Set the name of this CircuitBreaker

  56. def withRecoveryPolicy(recoveryPolicy: CircuitBreakerRecoveryPolicy): CircuitBreaker

    Permalink

    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

    Permalink

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

Deprecated Value Members

  1. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @Deprecated @deprecated @throws( classOf[java.lang.Throwable] )
    Deprecated

    (Since version ) see corresponding Javadoc for more information.

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